## timbomo -7

How can i make this into a menu where you select a letter and you get a response that reads

you have choosen "a" which is \$2.50

``````/* SIUE's bookstore is having aspecail sale on tiems embossed with the cougar logo. For a limited time, three items, mugs, teeshirts, and pens
are offered at a reduced rate with tax included to simplify the sales. Mugs are going for \$2.50, teeshirts for \$9.50 and pens for 75
cents. Coincidentally, your parents (or spouse, friend, coworker, or other person you know off-campus) just gave you \$30.00 to buy SIUE
stuff for them.*/

#include<iostream>
using namespace std;
int main()
{
char symb,symb1, symb2, symb3;
int item_purch, numb_item_purch, quit;
double mug, teeshirt, pen, tot_mon, curr_cash, mon_spent;

cout << "What do you want to buy today?\n";

cout << " A) Mugs \$2.50 " << endl;
cout << " B) teeshirt \$9.50 " << endl;
cout << " C) Pens .75 cents " << endl;
cout << " D) Quit" << endl;
cout << " Enter your letter and press Return when finished" << endl;
cin >> mug;
cin >> teeshirt;
cin >> pen;
cin >> quit;
mug = ('A' || 'a');
teeshirt = ('B' || 'b');
pen = ('C' || 'c');
{
if ((mug == 'A') || (mug == 'a'))
{

mug = 2.50;
}
else if ((teeshirt == 'B') || (teeshirt == 'b'))
{

teeshirt = ('B' || 'b');
}
else
{
cout << "Wrong select a letter" << endl;
}
}
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);

switch (symb)
{
case 'A':
cout << " A) Mugs \$2.50 ";
mug = 2.50;
break;
case 'B':
cout << " B) teeshirt \$9.50 ";
teeshirt = 9.50;
break;
case 'C':
cout << " C) Pens .75 cents ";
pen = .75;
break;
case 'D':
cout << " D) Quit" << endl;
quit = 0;
break;
}

return 0;
}
``````

## Lerner 582

replace this:

``````cin >> mug;
cin >> teeshirt;
cin >> pen;
cin >> quit;
mug = ('A' || 'a');
teeshirt = ('B' || 'b');
pen = ('C' || 'c');
{
if ((mug == 'A') || (mug == 'a'))
{

mug = 2.50;
}
else if ((teeshirt == 'B') || (teeshirt == 'b'))
{

teeshirt = ('B' || 'b');
}
else
{
cout << "Wrong select a letter" << endl;
}
}
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);``````

with

cin >> symb;

and you've created a menu requesting user input as type char which is stored in symb which is then used as the argument in a switch statement. If you then use something like this:

``````case 'A':
case 'a':
cout << " A) Mugs \$2.50 ";
mug = 2.50;
break;
.
.
.
default:
cout << "input error, enter only A, B, C or D;
break;``````

you are user friendly in that you let user enter either A or a (or any of the other appropriate letter combinations) and still proceed with the program. (You could also accomplish the same thing by using toupper() to make sure all input is in caps and thereby decrease the number of cases you need to write.)

## timbomo -7

im not getting where im sapost to put

cin >> symbol

or am i reading ur remarks wrong, i am new at this. when i compile it and run it, it shows the menu and when i press a letter it says

wrong letter

could you tell me if i got the right set up

## Lerner 582

Remove everything I said in my earlier post and put this line

cin >> symb;

right after this line

cout << " Enter your letter and press Return when finished" << endl;

and right before this line:

switch(symb)