Now, this is probably going to sound extremely stupid, seeing as i've only just started my programming module at university.
We've been given a basic outline of a program we have to create, and one of the basic stipulations, is that there be a menu system.
The menu system has 3 options, one of which is exit - so i'm assuming that 'break;' will take care of that. However, how on earth do i take an input and use that input for executing a function?
I've tried playing with the switch statement, but it never wants to compile, and throws up craploads of errors every time I try and use it.
I've included the code i've got so far for the whole program, and I would appreciate any help you could give me.
#include <iostream>
using namespace std;
void welcome_screen()
{
cout << "\t***************************************************************\n";
cout << "\t* *\n";
cout << "\t* Welcome to the TravelWithUs Booking and Information System *\n";
cout << "\t* *\n";
cout << "\t***************************************************************\n";
cout << endl;
}
/***************************************************************************************/
void menu_system()
{
char selection = ' ';
cout << endl;
cout << "The following options are available:\n";
cout << endl;
cout << "\tC. Country Information\n";
cout << "\tT. Travel Cost Information\n";
cout << "\tE. Exit";
cout << endl;
cout << endl;
cout << "Please choose an option: ";
cin >> selection;
cout << "You typed: " << selection;
}
/***************************************************************************************/
/***************************************************************************************/
int main()
{
welcome_screen();
menu_system();
return (0);
}
Bear in mind that for some daft reason, int main() has to be at the bottom of the C++ code, maybe our tutor is obsessive compulsive or something
TIA

New Topic/Question
Reply



MultiQuote




|