#include #include #include using namespace std; string pickfile(string prompt) { string myfilename; cerr << prompt << ": "; getline(cin,myfilename); return myfilename; } void savefile() { string data; data=pickfile("Enter file would you like to save"); cout << "Saving..." << data << endl; } void printfile() { string data; data=pickfile("Enter file would you like to print"); cout << "Printing..." << data << endl; } void quitprogram() { cout << "Goodbye.."; exit(0); } void instructions() { cerr << "This is some application..." << endl; } void menu() { string command; // Always display the menu. while(true) { cerr << endl; cerr << "S - Save" << endl ; cerr << "P - Print" << endl ; cerr << "Q - Quit" << endl ; cerr << endl; getline (cin,command); switch(command[0]) { case 's': case 'S': savefile(); break; case 'p': case 'P': printfile(); break; case 'q': case 'Q': quitprogram(); default: cerr << "I don't understand " << command << endl; } } } int main() { instructions(); menu(); }