Simple Switch – CSKC
Sign In

Search

Code Learning #CPP#7615    siteicon   siteicon  

Simple Switch

Source Code

TC++ #7615

Source Code

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

Code Understanding

This program displays the day of the week based on the number entered by the user using a switch statement.
• int d; declares a variable to store the day number.
• cin >> d; takes input from the user.
• switch(d) checks the value of d and executes the corresponding case:
o 1 → Monday
o 2 → Tuesday
o 3 → Wednesday
o 4 → Thursday
o 5 → Friday
o 6 or 7 → HOLIDAY (both weekend days)
• default handles any invalid input (numbers not 1-7).
• break; ensures only the matching case runs.


Share

Created: 1-Mar-2026 16:56 | Updated: 19-Apr-2026 18:46|