This is my code.
#include <iostream>
#include <string>
using namespace std;
int main() {
cout << "Welcome to Starbucks! What would you like to order?" << endl;
cout
<< "Before you select your order, would you like to look at your wallet to see how much money you have on you right now? "
<< flush;
string input;
cin >> input;
if (input == "Yes" || input == "yes") {
cout << " " << endl;
cout << "OK. You have $18.90 in your wallet. Now showing menu. "
<< flush;
}
else {
cout << " " << endl;
cout << "OK. Now showing menu. " << endl;
}
cout << "\n\n\tDrinks:\n\nHot Coffees\nHot Teas\nHot Drinks\nFrappuccino Blended Beverages\nCold Coffees\n\n\tFood:\n\nHot Breakfast"
"\nBakery\nLunch\nSnacks & Sweets\nYogurt & Custard\n\n\tMerchandise:\n\nDrinkware" << endl;
string option;
cout << "Select an option from one of these sections. Type your selection here: " << flush;
getline(cin, option);
if (option == "Hot Coffees" || option == "hot coffees" || option == "Hot coffees" || option == "hot Coffees") {
cout << "Welcome to the Hot Coffees section. Here is a list of all the hot coffees we sell:\n\nAmericanos:\n\nCaffè Americano\nStarkbucks Blonde Caffè Americano\n" << endl;
}
return 0;
}
At the very end, when I decide to use a getline function (I want to get the input of the user to use in if statements), I am unable to type into my console for an unknown reason, therefore making me unable to get the user's input. I have already tried cin.ignore(); , and although this let me type into the console, after I typed the words "Hot Coffees", it didn't print out "Welcome to the Hot Coffees section.", even though I programmed my if statement to print this out if(option == "Hot Coffees"). If you can figure this out, thank you! If you can't, I am certainly glad you at least tried, and I will be just as thankful.