+ 1

hi please there is a error in the parctise for switches and i am sure there is no proplem

int choice = 0; cin >> choice; //1-Latte //2- Americano //3- Espresoo //4- Cappuccino //5-Macchiato switch(choice) { case 1: cout << "Latte"; break ; case 2: cout <<"Americano" ; break ; case 3: cout << "Espresoo" ; break ; case 4: cout << "Cappuccino" ; break ; case 5: cout << "Macchiato"; break;} return 0; cout<< choice; }

5th Jul 2022, 7:13 PM
Ahmed Tamer
Ahmed Tamer - avatar
2 Respostas
+ 7
Check your spelling cout << "Espresoo" ; Should be "Espresso"
5th Jul 2022, 7:33 PM
Chris Coder
Chris Coder - avatar
+ 2
You can run in playground and see it yourself.. If you found any problem them you can ask here.. And sure to share full code or error code possibly by saving it.. cout << choice; after return 0; has no use. because It won't executed.. Hope it helps..
5th Jul 2022, 7:23 PM
Jayakrishna 🇮🇳