I need help with part d of this lab i have to do. I have tried a lot of ways but cant find a way to work it out. Any help is appreciated!i already did all except part D. Im going to copy and paste what i've done so far. So please assist me with part D! Thanks!
I. Write a C++ program that prints out the following menu for a game:
***************************************************
Welcome!
Please choose a number from the following options:
1. Play the game!
2. Demo the game!
3. Exit
****************************************************
II. Modify your program from Part I, in the following way.
A. Instead of simply having the message Welcome!, have the welcome message use the user’s name. Prompt the user for a name and then have a personalized welcome message. IF the user inputs the name Sue, the welcome message might say, “Welcome, Sue!”
B. Allow the user to personalize the look of the menu. Before you print out the menu, prompt the user for a character to be used for the menu border. Then, use that character instead of the asterisk (*) so that the menu is personalized.
C. Instead of ending the program with the final line of asterisks print a message to the user stating which menu number choice he/she has chosen. For example, if the user inputs a 1, a message should be printed.
You have chosen a 1.
D. Complete the border of the menu so that it forms a square around the banner instead of just a line above and below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int number;
char c2;
c2 = 'a';
cout << "Which number should be used for the menu border?";
cin >> c2;
cout << "What name should be used to Welcome the user?";
cin >> name;
cout << left << setfill('a') << setw(80) << c2 << endl;
cout << "\n Please choose a number from the following options:" << endl;
cout << "\t\n\n\t1. Play the game!" << endl;
cout << "\t2. Demo the game!" << endl;
cout << "\t3. Exit.\n\n\n" << endl;
cout << 'a' << left << setfill('a') << setw(79) << c2 << endl;
cout << "Which menu number choice you chose?";
cin >> number;
number = 1;
cout << "You have chosen a " << number << endl;
return 0;
}
|