Hi I am back I need am working on an unfinished project and cant get it to compile past line 44 , any help with why it wont do that would be great . I just am trying to get what I currently have to compile . my assignment , is a long way from complete, as I have to create an array that will allow the deletion and sorting of a product. I just am wanting to know what I am doing wrong currently is all. I also have comment lines in the program If someone could explain those to me that would be great. I emailed my instructor yesterday but no response yet. I hope you guys can help me some.

#include <cstdlib>
#include <iostream>
#include<string>
using namespace std;
void pause();// pause function prototype 
 int menu();// menu function prototype
 void add();// add function prototype
 void remove(); //remove function prototype
 void sort();//remove function prototype


int main()// main 
 {
int cont =1;//what is cont i do not remember it is here and down further
 do{
             int choice = menu();
 switch (choice) // switch statement           
//cout<<choice<<endl;//switch here if choice is 1 do add 2 remove 3 sort 4exit
{ //open switch statement
    case 1: cout<<"\n\n";
        break;

    case 2: cout<< "\n";
         break;

    case 3: cout<< "\n\n";
        break;

    case 4: cout << "Invalid number, please enter a number"
              << " from the entrees above.\n\n";
        break;
    } //close switch statement



pause();
}while(cont==2);// can you explain what cont==2 does here please//open while


    pause();
    return 0;
}//close while
void pause();//also explain what this does , pauses the screen i think
{//open 
     cout<<"press enter to continue"<<endl;
     cin.ignore(80,'\n');// can you explain what this does here for me please
 }//close  


 int menu()// menu function
 {//open menu
     int c =-1;//this set the input to be greater than 1 correct?
     while(c<1||c>4)// this makes sure the loop is correct?
 {//open while
     system("cls");// clears the screen
     cout<<"1. Add\n"// places a menu on the screen
         <<"2. Delete\n"
         <<"3. Sort\n"
         <<"4.Exit\n";
         cout<<"selection:";
         cin>>c;//takes the user input and stores it as c

}//end while
return c;// returns the user input at c
}//end menu func
 void add()// add function
 {// open void function
 cout<<"add";//prints add on screen
 pause();
 }//close void function
 void remove()// remove function
 {//open remove function
 cout<<"remove";// prints remove on screen
 pause(); 
      }//close remove function
 void sort()// void function
 {//open sort function
  cout<<"sort";// prints sort on screen
 pause();    
      }//close sort function

Recommended Answers

All 2 Replies

line 44: remove the semicolon. As it is, it's just a function prototype.

line 46: ignore() removes one or more keys from the keyboard buffer.

When you come across a function that you don't know what it does you need to use google to find out about it.

great thanks a lot . I did a bunch of google searches and came up with nothing before I came here, so thanks. that's awesome...

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.