View Single Post
Old May 23rd, 2006, 4:05 PM   #16
Twilight
Programmer
 
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3 Twilight is on a distinguished road
The menu was the easiest part. I just had something like the following:

std::list<Employee*> employees;

int main()
{
    string choice;
    while(1)
    {
        cout << "Decribe the options you want the user to choose from" << endl;
        cin >> choice;
        //parse choice from a string to an int

        switch(int version of choice)
        {
            case 1:  
                 //do choice1 stuff
                 system("cls");
                 break;
            case 2:
                 //do choice2 stuff
                 system("cls"); 
                 break;
            case 3:
                 //quit
                 return 0;
            default:
                 system("cls");
                 cout << "Invalid selection, ";
        }
    } 
}

This just loops forever until the user chooses your quit option. And by adding more cases, you can add more options for the user.
Twilight is offline   Reply With Quote