123456789101112131415161718192021
# include <iostream> using namespace std; int main() { cout << "Menu :" << endl; cout << "1 : Ice cream" << endl; cout << "2 : Pudding" << endl; int dessert; cout << "Pick a dessert" cin >> dessert; if(dessert==1) cout << "Take your ice cream" << endl; else if(dessert==2) cout << "Take your pudding" << endl; else cout << "Get out of my face" << endl; return 0; }
12345678910111213141516171819202122
# include <iostream> # include <string> using namespace std; int main() { cout << "Menu :" << endl; cout << "Ice cream" << endl; cout << "Pudding" << endl; string dessert; cout << "Pick a dessert -> "; getline(cin,dessert); if(dessert=="ice cream") cout << "Take your ice cream" << endl; else if(dessert=="pudding") cout << "Take your pudding" << endl; else cout << "I said get out of my face" << endl; return 0; }