This keep failing the 5th test, why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

This keep failing the 5th test, why?

#include <iostream> using namespace std; int main() { int choice; cin >> choice; switch (choice) { case 1: cout << "Latte"; break; case 2: cout << "Americano"; break; case 3: cout << "Expresso"; break; case 4: cout << "Cappuccino"; break; case 5: cout << "Macchiato"; break; } }

16th Dec 2022, 6:14 PM
Bezu Tadesse
Bezu Tadesse - avatar
3 Answers
+ 1
#include <iostream> using namespace std; int main() { int choice; cin >> choice; switch (choice) { case 1: cout << "Latte"; break; case 2: cout << "Americano"; break; case 3: cout << "Expresso"; break; case 4: cout << "Cappuccino"; break; case 5: cout << "Macchiato"; break; } return 0; }
16th Dec 2022, 6:18 PM
Bezu Tadesse
Bezu Tadesse - avatar
0
Okay, I understand now I didn't write a return command.
16th Dec 2022, 6:17 PM
Bezu Tadesse
Bezu Tadesse - avatar
0
Bezu Tadesse Pls avoid giving finished code as answer, because it makes the OP to skip the most important part of learning process. Prefer giving hints for the OP to find the solution.
16th Dec 2022, 6:36 PM
Emerson Prado
Emerson Prado - avatar