This code when compiled ...saids it contains infinite loop but i don't how to fix it? can someone tell me what im doing wrong?
~thank you
#include <iostream>
#include <string>
using namespace std;
// this program asks the user to order an ice cream
int main()
{
string flavor = "", sauce = "", sprinkles = "";
string order;
while (sprinkles == "")
{
if (flavor == "")
cout << "Do you want chocolate, vanilla or twist" << endl;
if (sauce == "")
cout << "Hot fudge, chocolate or strawberrry sauce?" << endl;
if ( sprinkles== "")
cout << "Do you want sprinkles <yes/no>?" << endl;
getline(cin, order);
if( sprinkles == "" && sauce != "" && flavor !="")
if( order == "yes" || order =="no" )
sprinkles = order;
if(sprinkles == ""&& sauce == "" && flavor !="")
if ((order == "fudge") || (order == "chocolate")
|| (order == "strawberry"))
sauce = order;
if(sprinkles == ""&& sauce == "" && flavor =="")
if ((order == "chocolate") || (order == "vanilla")
|| (order == "twist"))
flavor = order;
}
if (sprinkles == "yes")
cout << "you ordered " << flavor << " ice cream with " << sauce << " sauce and sprinkles." << endl;
else
cout << "You ordered " << flavor << " ice cream with " << sauce << " " << "sauce and without sprinkles." << endl;
return 0;
}