Hi Bazzy thank you for the hint...
I changed my code and the program is working but I need the program to ask all the three question together until the user input all the answers...
example:
question about icecream flavor
question about sauce
question about sprinkles
if user input sauce then the program show only two questions:
question about icecream flavor
question about sprinkles
and then if user input sauce then the program will ask the last question:
sprinkes yes or no?
I believe I should accomplish this using the while condition and that is why before I used
while( icrecreamFlavor == "" && sauceFlavor=="" && sprinkles=="" );
but this way I will still have the problem with the chocolate....
I will keep working on my code
if you have more hints please for them here
thank you for all the help guys
Sorry forgot to include my new code:
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 28
|
string icecreamFlavor="", sauceFlavor="", sprinkles="";
string icecreamOrder="", sauceOrder="", sprinklesOrder="";
do
{
cout << "Do you want chocolate, vanilla or twist?" << endl;
getline (cin, icecreamFlavor);
}
while( icecreamFlavor!="chocolate" && icecreamFlavor!="vanilla" && icecreamFlavor!="twist" );
do
{
cout << "Hot fudge, chocolate or strawberry sauce?" << endl;
getline (cin, sauceFlavor);
}
while( sauceFlavor!="hot fudge" && sauceFlavor!="chocolate" && sauceFlavor!="strawberry" );
do
{
cout << "Do you want sprinkles (yes/no)?" << endl;
getline (cin, sprinkles);
}
while( sprinkles!="yes" && sprinkles!="no" );
if(sprinkles == "yes")
sprinklesOrder = "and sprinkles";
if(sprinkles == "no")
sprinklesOrder = "without sprinkles";
cout << "You ordered " << icecreamFlavor << " ice cream with " << sauceFlavor << " sauce " << sprinklesOrder << endl;
|