Hi guys, I am doing this problem for homework, and there is one error that I don't know how to fix.
Assume that an int variable age has been declared and already given a value and assume that a char variable choice has been declared as well. Assume further that the user has just been presented with the following menu:
S: hangar steak, red potatoes, asparagus
T: whole trout, long rice, brussel sprouts
B: cheddar cheeseburger, steak fries, cole slaw
(Yes, this menu really IS a menu!)
Write some code that reads a single character (S or T or B) into choice . Then the code prints out a recommended accompanying drink as follows:
If the value of age is 21 or lower, the recommendation is "vegetable juice" for steak, "cranberry juice" for trout, and "soda" for the burger. Otherwise, the recommendations are "cabernet", "chardonnay", and "IPA" for steak, trout, and burger respectively. Regardless of the value of age , your code should print "invalid menu selection" if the character read into choice was not S or T or B.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
cin >> choice;
if (choice == 'S')
{if (age <= 21)
cout << "vegetable juice";
cout << "cabernet";}
else if (choice == 'T')
{if (age <= 21)
cout << "cranberry juice";
cout << "chardonnay";}
else if (choice == 'B')
{if (age <= 21)
cout << "soda";
cout << "IPA";}
else
cout << "invalid menu selection";
|
It says "The value of _stdout is incorrect.", so what did I do wrong? :O