C++ Program: Day of the Week with switch statement

By: Prof. Dr. Fazal Rehman Shamil | Last updated: July 13, 2024

Write a Simple program in C++ to print Day of the Week using switch statement .

Output

Example Output #1

Enter a number (1-7) to get the day of the week:
1
Monday

Example Output #2

Enter a number (1-7) to get the day of the week:
3
Wednesday

Example Output #3

Enter a number (1-7) to get the day of the week:
5
Friday

Example Output #4

Enter a number (1-7) to get the day of the week:
7
Sunday

Example Output #5

Enter a number (1-7) to get the day of the week:
8
Invalid input! Please enter a number between 1 and 7.

Example Output #6

Enter a number (1-7) to get the day of the week:
0
Invalid input! Please enter a number between 1 and 7.