heya, i am working on this program wonderig anyone can help me finish it .

i put in most of the //info on whats suppose to happen but am having trouble figuring out actually how to.

*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
mySwap( Array[count], Array[count+1]);            //disp array in asc or desc

using namespace std;

void main()
{

	//local constants
	const int ARRAY_SIZE   = 5;
	const int QUIT         = -99;
    
	//local variables
    Array[ARRAY_SIZE];  //an array to store the integers
	int count = 0	 ;	//a count of #s stored in the array
	Num_Input	;	    //the number input by the user
    int Result ;        //Result of number for arrary display
	/**************************start main program*********************/

    //Init array count to 0
    for (int 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 if
	//END WHILE
	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 == D)
       {
		//Call display function to display array values in asc order
    	mySwap( Array[Count], Array[--Count]);
    	
    //ELSE
		//Call display function to display array values in desc order
	//END IF

}   //end main program

I'm not sure you ever define the function array_insert(), I don't see it defined anywhere, nor do you actually put any values into it. I'm not that good with c++ yet, but that's the first problem I see. Just my thoughts.

where do i need to put array_insert()?

line 48: you must specify a data type, such as int Array[ARRAY_SIZE]; line 50: You need to specify data type here too.

line 55: remove that semicolon at the end of the line.

line 56: Need opening brace {. Add closing } at the end of the loop.

line 61 and 62: Delete them because they are not needed.

line 64: That is not calling the function -- that is just a function prototype.

There are probably other problems, such fix the above, recompile, and report if you still have questions.

Thank you for replys made some adjustments but still need help. I am going to edit it after posting so i can say specific lines.

line 115- i am still not calling the function corectly, what is the correct way?
line 120 - what function am i calling??

/**********************************************************************
*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
                                          //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, int, int[]);
	}
    //ELSE
		else if (Result == ASCENDING)
		{
			//Call display function to display array values in desc order
	    
		}
		//END IF
	
		}
	}
}   //end main program
/**********************************************************************
*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
                                          //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 , int, int[]);
	}
    //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 Abs =0

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

	//Cal # of values to display
	Abs = (Start - Stop) + 1;

	if (RESULT == DESCENDING)
	{
		//Set array position update value to poistive 1
		Pos = 1;
	}
	else (RESULT == ASCENDING)
	{
		//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 (Abs = 0 ; Abs < Pos ; Abs ++)
		if (

line 42: void main() main always always returns an int -- never void. The only acceptable way to code it is int main() or int main(int argc, char* argv[]).

line 115: The way you call a function is by putting variable names as the two parameters. What you have posted is a function prototype, and all it does is tell the compiler what type of parameters the function should have. Look at line 157, the actual function. That will tell you what parameters to pass on line 115.

If you are still confused about how to pass parameters then read one of the many tutorials on the net, for example this one.

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.