Hi i put most of the //discriptions in so it should be easy to tell what is suppose tohappen where. It is longer then it seems, its very beginner level. Also im not sure i did the functions and arrays perfect.

Errors i have before i have been able to run are:

line 44 `main' must return `int'
line 115 expected primary-expression before "int"
line 115 expected primary-expression before "int"
line 115 expected primary-expression before "int"
line 127 expected declaration before '}' token

/***********************************************************************
*Program Description:  This program is designed to insert numbers into 
*   an array in ascending order.  After the numbers have been inserted 
*   the user will have the option to display the numbers back to the  
*   screen in either ascending or descending order.  A function will  
*   be used to insert the number into the correct position in the  
*   array.  Another function will be used to display the numbers back 
*   to the screen. 
* 
*BEGIN - Lab 9,  Creating my own functions 
*  Init array count to 0 
*	Prompt user for first input or QUIT 
*	WHILE (input is not QUIT) 
*		Call function to insert the value into the array 
*		Increment the array count by 1 
*		IF (the Array is now full) 
*			Make input = QUIT to exit the loop 
*		ELSE //the array is not full 
*			Prompt user for next input or QUIT 
*		END IF 
*	END WHILE 
*	Clear Screen 
*	Ask user if they want to display in Ascending or Descending order 
*	Display Title 
*	IF (User wants ascending order) 
*		Call display function to display array values in asc order 
*	ELSE 
*       Call display function to display array values in desc order 
*	END IF 
*END - Lab 9 - Creating my own functions 
*********************************************************************/ 



#include <iostream>
#include <iomanip>

//local functions stored at bottom of the file
void array_insert(int, int, int[]);       //insert 1 value into array
void array_disp (int, int, int[]);                                          //disp array in asc or desc 

using namespace std; 
void main()
{ 	
	//local constants	
	const int ARRAY_SIZE   =  5;	
	const int QUIT         =-99; 
	const char ASCENDING    ='A';
	const char DESCENDING   ='D';
	
	
	//local variables    
	
	int Array[ARRAY_SIZE];  //an array to store the integers	
	int count = 0	 ;	    //a count of #s stored in the array	
	int Num_Input	;	    //the number input by the user    
	int Result ;            //Result of number for arrary display
	char Letter_Code;       //For acending or decending
	
/*******************************************************/	

    //Init array count to 0
    for (count =0; count < ARRAY_SIZE; count++)
    {
	//Prompt user for first input or QUIT
	cout << "Enter first input or Quit";
	cin >> Num_Input;
	//WHILE (input is not QUIT)
	   while (Num_Input =! QUIT)
	   {
 		//Call function to insert the value into the array
        void array_insert(int, int, int[]);         	
    	
		//Increment the array count by 1
		count++;
        
		//IF (the Array is now full)
 			if (count > ARRAY_SIZE)
 			{
             
				//Make input = QUIT to exit the loop
             Num_Input = QUIT;
			}
			 //ELSE //the array is not full
			else if (count < ARRAY_SIZE)
            {
				//Prompt user for next input or QUIT
		cout << "Enter number or Quit";
		cin >> Num_Input;
            }
                         
        //END IF
        
	
			//END WHILE
	
	   }
	
	   //Clear Screen
	system("cls");
    
	//Ask user if they want to display in Ascending or Descending order
	cout << "Enter A for Acending order and D for Decending order";
    cin >> Result ;
    
	//Display Title
    cout << "\n\n\n\n\n";
    cout << "The Numbers";
    Letter_Code = toupper(Letter_Code);
	
	//IF (User wants ascending order)
	if (Result == DESCENDING)
    {
		//Call display function to display array values in asc order
		array_insert(int Num, int Count, int Array[]);
        }
    //ELSE
		else if (Result == ASCENDING)
		{
			//Call display function to display array values in desc order
	    
		}
		//END IF
	
		}
	}
}   //end main program
}


/**********************************************************************
 *Program Name   : Array Insert in Ascending Order 
 *Author         :   
 *Date           :   
 *Course/Section :   
 *Program Description:  This function is designed to insert a single
 *   value into an array in ascending order.  The number, the count
 *   of elements currently in the array, and the array will be passed 
 *   in as parameters.  The function will first find the correct 
 *   position where the number should be inserted.  It will then move 
 *   of the values that are greater than the number down 1 position in
 *   the array starting with the end of the array.  The number will 
 *   then be stored in the correct position
 *
 *BEGIN - Ins # in array in asc order (int Num,int Count.int Array[])
 *  Init array position counter (pos) to 0 (beginning of array)
 *	WHILE (Not at the end of the array && the insert position is not found)
 *		Increment pos
 *	END WHILE	
 *	FOR (Each array value that needs to be moved to make room to insert)
 *		Move the value down 1 position in the array
 *	END FOR
 *	Insert the number in the array at pos
 *END - Ins # in array in asc order
 *********************************************************************/

void array_insert(int Num, int Count, int Array[])
{
	//local constants

	//local variables
	int Pos = 0;       //current position in the array

	/**************** begin insert ***********************************/

	//WHILE (!the end of the array && the insert position is not found)
	while (Pos < Count && Num > Array[Pos])
	{	
		//Increment pos
		Pos++;
	}
	//END WHILE

	//FOR (Each array value that needs to be moved to make room to insert)
	for(int Index = Count; Index > Pos; Index--)
	{
		//Move the value down 1 position in the array
		Array[Index] = Array[Index-1];	
	
	//END FOR
	}
	//Insert the number in the array at pos
	Array[Pos] = Num;

}// end array_insert

/**********************************************************************
 *Program Name   : Display array in asc or desc order 
 *Author         :   
 *Date           :   
 *Course/Section :   
 *Program Description:  This function is designed to display the array
 *  in either forward or reverse order.  The function receives the
 *  start index and the stop index to move thru the loop.  First, the 
 *  function determines the total number of values to display by 
 *  finding the difference between the Start and Stop indexes and then
 *  adding 1. Then the direction is determined (forward or reverse) so 
 *  that the array position counter can be incremented or decremented
 *  by 1. Lastly, a for loop is executed to display the contents of 
 *  the array in the correct order.
 *
 *BEGIN - Disp array in fwd or rev (int Start, int Stop, int Array[])
 *  Calc # of values to display (abs value of (Start - Stop) + 1)
 *	IF (display is in ascending order)
 *		Set array position update value to a positive 1
 *	ELSE //display is in descending order
 *		Set array position update value to a negative 1
 *  END IF
 *  Set array position to Start Index
 *  FOR(# of values to display)
 *		Display the value at array position
 *		Modify the array position by the array position update value
 *	END FOR
 *END - Display array in forward or reverse
 *********************************************************************/

void array_insert (int Start, int Stop, int Array[])


{
	//local constants
	const char ASCENDING    ='A';
	const char DESCENDING   ='D';

	//local variables
	int RESULT =0

	/**************** begin insert ***********************************/

	//Call # of values to display
	RESULT = (Start - Stop) + 1;

	if (RESULT == void array_insert(int Num, int Count, int Array[])
	{
		//Set array position update value to poistive 1
		Pos = 1;
	}
	else (DESCENDING)
	{
		//Set array position update value to negative 1
		Pos = -1;
	}
	//end if
	//Set array poistion to start
	Array[Pos] = Start;

		//For number of values display
	for (int i = 0; i < Array[Count]; i++)
	{
    cout << Array[Count];
	cout << endl;
    }

line 44 `main' must return `int'

Your main() function basically has to return something no matter what, and void means it's returning nothing.

line 127 expected declaration before '}' token

I always put:

return 0;
}

at the end of my programs, since each function needs to return a value.

>>line 44 `main' must return `int'

refers to you having : "void main()";

it should be :

int main(){ 
//code
return 0;
}

This part :

while (Num_Input =! QUIT)

should be :

while (Num_Input != QUIT) //reads not equal to

This :

void array_insert(int, int, int[]);

is not how you call a function.
this is how you call a function :

#include<iostream>
using namespace std;
void callMe(int a){
   cout<<"hello number : "<<a << "\n"; 
  };

int main() { //notice int main!
  callMe(5); //function call
  return 0; //return 0 meaning exit the program successfully 
}

Another thing :

if (count > ARRAY_SIZE) {...}
else if (count < ARRAY_SIZE) {...}

What happens if count equal ARRAY_SIZE ?

Again , wrong way to call a function :

array_insert(int Num, int Count, int Array[]);

correct way :

array_insert( Num, Count, Array);

Fix all of that in all of you code and then return back if you need to.

Thank you for replys, wow my head hurts. I tried to fix the functioncalls what i can, i assume there not right i dont have my book with me, which is annoying. anyway...

errors:

76 expected primary-expression before "int"
76 `;' before "int"
121 expected primary-expression before "int"
121 expected primary-expression before "int"
121 expected primary-expression before "int"
121 At global scope:
133 expected declaration before '}' token

/***********************************************************************
*Program Description:  This program is designed to insert numbers into 
*   an array in ascending order.  After the numbers have been inserted 
*   the user will have the option to display the numbers back to the  
*   screen in either ascending or descending order.  A function will  
*   be used to insert the number into the correct position in the  
*   array.  Another function will be used to display the numbers back 
*   to the screen. 
* 
*BEGIN - Lab 9,  Creating my own functions 
*  Init array count to 0 
*	Prompt user for first input or QUIT 
*	WHILE (input is not QUIT) 
*		Call function to insert the value into the array 
*		Increment the array count by 1 
*		IF (the Array is now full) 
*			Make input = QUIT to exit the loop 
*		ELSE //the array is not full 
*			Prompt user for next input or QUIT 
*		END IF 
*	END WHILE 
*	Clear Screen 
*	Ask user if they want to display in Ascending or Descending order 
*	Display Title 
*	IF (User wants ascending order) 
*		Call display function to display array values in asc order 
*	ELSE 
*       Call display function to display array values in desc order 
*	END IF 
*END - Lab 9 - Creating my own functions 
*********************************************************************/ 



#include <iostream>
#include <iomanip>

//local functions stored at bottom of the file
void array_insert(int, int, int []);       //insert 1 value into array
void array_disp (int, int, int[]);                                          //disp array in asc or desc 

using namespace std; 
main()
{ 	
	//local constants	
	const int ARRAY_SIZE   =  5;	
	const int QUIT         =-99; 
	const char ASCENDING    ='A';
	const char DESCENDING   ='D';
	
	
	//local variables    
	
	int Array[ARRAY_SIZE];  //an array to store the integers	
	int count = 0	 ;	    //a count of #s stored in the array	
	int Num_Input	;	    //the number input by the user    
	int Result ;            //Result of number for arrary display
	char Letter_Code;       //For acending or decending
	
/*******************************************************/	

    //Init array count to 0
    for (count =0; count < ARRAY_SIZE; count++)
    {
	//Prompt user for first input or QUIT
	cout << "Enter first input or Quit";
	cin >> Num_Input;
	//WHILE (input is not QUIT)
	   while (Num_Input != QUIT)
	   {
 		//Call function to insert the value into the array
        void array_insert(int Num_Input, int count, int Array[]);
        {   
               
            }
             int main() {             // int main  
             array_insert(int count); //function call  
             return 0;                //return 0 meaning exit the program successfully 
             }
		//Increment the array count by 1
		count++;
        
		//IF (the Array is now full)
 			if (count > ARRAY_SIZE)
 			{
             
				//Make input = QUIT to exit the loop
             Num_Input = QUIT;
			}
			 //ELSE //the array is not full
			else if (count <= ARRAY_SIZE)
            {
				//Prompt user for next input or QUIT
		cout << "Enter number or Quit";
		cin >> Num_Input;
            }
                         
        //END IF
        
	
			//END WHILE
	
	   }
	
	   //Clear Screen
	system("cls");
    
	//Ask user if they want to display in Ascending or Descending order
	cout << "Enter A for Acending order and D for Decending order";
    cin >> Result ;
    
	//Display Title
    cout << "\n\n\n\n\n";
    cout << "The Numbers";
    Letter_Code = toupper(Letter_Code);
	
	//IF (User wants ascending order)
	if (Result == DESCENDING)
    {
		//Call display function to display array values in asc order
		array_insert(int Num, int count, int Array[]);
        }
    //ELSE
		else if (Result == ASCENDING)
		{
			//Call display function to display array values in desc order
	    void array_insert(int Num, int Count, int Array[]);
		}
		//END IF
	
		}
	}
}  
 //end main program
return 0;
}


/**********************************************************************
 *Program Name   : Array Insert in Ascending Order 
 *Author         :   
 *Date           :   
 *Course/Section :   
 *Program Description:  This function is designed to insert a single
 *   value into an array in ascending order.  The number, the count
 *   of elements currently in the array, and the array will be passed 
 *   in as parameters.  The function will first find the correct 
 *   position where the number should be inserted.  It will then move 
 *   of the values that are greater than the number down 1 position in
 *   the array starting with the end of the array.  The number will 
 *   then be stored in the correct position
 *
 *BEGIN - Ins # in array in asc order (int Num,int Count.int Array[])
 *  Init array position counter (pos) to 0 (beginning of array)
 *	WHILE (Not at the end of the array && the insert position is not found)
 *		Increment pos
 *	END WHILE	
 *	FOR (Each array value that needs to be moved to make room to insert)
 *		Move the value down 1 position in the array
 *	END FOR
 *	Insert the number in the array at pos
 *END - Ins # in array in asc order
 *********************************************************************/

void array_insert(int Num, int Count, int Array[])
{
	//local constants

	//local variables
	int Pos = 0;       //current position in the array

	/**************** begin insert ***********************************/

	//WHILE (!the end of the array && the insert position is not found)
	while (Pos < Count && Num > Array[Pos])
	{	
		//Increment pos
		Pos++;
	}
	//END WHILE

	//FOR (Each array value that needs to be moved to make room to insert)
	for(int Index = Count; Index > Pos; Index--)
	{
		//Move the value down 1 position in the array
		Array[Index] = Array[Index-1];	
	
	//END FOR
	}
	//Insert the number in the array at pos
	Array[Pos] = Num;

}// end array_insert

/**********************************************************************
 *Program Name   : Display array in asc or desc order 
 *Author         :   
 *Date           :   
 *Course/Section :   
 *Program Description:  This function is designed to display the array
 *  in either forward or reverse order.  The function receives the
 *  start index and the stop index to move thru the loop.  First, the 
 *  function determines the total number of values to display by 
 *  finding the difference between the Start and Stop indexes and then
 *  adding 1. Then the direction is determined (forward or reverse) so 
 *  that the array position counter can be incremented or decremented
 *  by 1. Lastly, a for loop is executed to display the contents of 
 *  the array in the correct order.
 *
 *BEGIN - Disp array in fwd or rev (int Start, int Stop, int Array[])
 *  Calc # of values to display (abs value of (Start - Stop) + 1)
 *	IF (display is in ascending order)
 *		Set array position update value to a positive 1
 *	ELSE //display is in descending order
 *		Set array position update value to a negative 1
 *  END IF
 *  Set array position to Start Index
 *  FOR(# of values to display)
 *		Display the value at array position
 *		Modify the array position by the array position update value
 *	END FOR
 *END - Display array in forward or reverse
 *********************************************************************/

void array_insert (int Start, int Stop, int Array[])


{
	//local constants
	const char ASCENDING    ='A';
	const char DESCENDING   ='D';

	//local variables
	int RESULT =0

	/**************** begin insert ***********************************/

	//Call # of values to display
	RESULT = (Start - Stop) + 1;

	if (RESULT == void array_insert(int Num, int Count, int Array[])
	{
		//Set array position update value to poistive 1
		Pos = 1;
	}
	else (DESCENDING)
	{
		//Set array position update value to negative 1
		Pos = -1;
	}
	//end if
	//Set array poistion to start
	Array[Pos] = Start;

		//For number of values display
	for (int i = 0; i < Array[Count]; i++)
	{
    cout << Array[Count];
	cout << endl;
    }

Now it looks like a cut and paste disaster. Scrap the last post and go back to your first post. Then using post #1 try fixing one error at a time as suggested in post #s 2 and 3. (Better yet, in the future only write one or two lines, at most 1 action or small function, at a time before compiling and checking.).

So start with the response in post #2. Fix the return type for main() and recompile. If the initial error message goes away either go to next error as returned by the compiler or go to the responses in post #3. In either case, fix them one at a time and recompile after each fix. Chances are none of the fixes will require a cut/paste so don't do it unless you are very confident of what you are doing.

changes that i made were...

main()
{   


    //WHILE (input is not QUIT)
       while (Num_Input != QUIT)
       {
        //Call function to insert the value into the array
        void array_insert(int Num_Input, int count, int Array[]);
        {   

            }
             int main() {             // int main  
             array_insert(int count); //function call  
             return 0;                //return 0 meaning exit the program successfully 
             }

next...
im not sure if this will call the function correctly

    //Call display function to display array values in asc order
        array_insert(int Num, int count, int Array[]);
        }
    //ELSE
        else if (Result == ASCENDING)
        {
            //Call display function to display array values in desc order
        void array_insert(int Num, int Count, int Array[]);
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.