0

The default case,you are making a game where the player select the directly level 1 easy, 2-medium3 hard you are given a program

Switch case

19th Nov 2022, 8:10 PM
Sandeep Kumar
Sandeep Kumar - avatar
8 Respostas
+ 2
Be clear about question and share your try!!. https://www.sololearn.com/discuss/333866/?ref=app
19th Nov 2022, 8:18 PM
Jayakrishna 🇮🇳
+ 1
Your attempt?
19th Nov 2022, 8:34 PM
Jayakrishna 🇮🇳
+ 1
Am asking to share your try.. If you share it then it helps to find mistake in code if any.. Or what went wrong.. !
19th Nov 2022, 9:23 PM
Jayakrishna 🇮🇳
0
The default case you are making a game where the player select the directly level 1 easy ,2 medium ,3 hard you are given a program that text the number as input complete the program so that it will output the corresponding difficulty level it if the user entire and invalid number the program should output "invalid option" sample input -2 sample output - medium use the default case to execute the invalid option message
19th Nov 2022, 8:22 PM
Sandeep Kumar
Sandeep Kumar - avatar
0
Yes, but case3 and case 5 do not match
19th Nov 2022, 8:35 PM
Sandeep Kumar
Sandeep Kumar - avatar
0
OK thanks
19th Nov 2022, 9:24 PM
Sandeep Kumar
Sandeep Kumar - avatar
0
Console.WriteLine("Invalid option"); // Write capital I
19th Nov 2022, 10:34 PM
SoloProg
SoloProg - avatar
0
switch (num) { case 1: Console.WriteLine("Easy"); break; case 2: Console.WriteLine("Medium"); break; case 3: Console.WriteLine("Hard"); break; default: Console.WriteLine("Invalid option"); break; }
19th Nov 2022, 10:36 PM
SoloProg
SoloProg - avatar