C++ Program to Print Day Based on Given Number using Switch Case

Write C++ Program to Print Day Based on Given Number using Switch Case

// CPP program to print day based on given number using switch case

#include <iostream>

using namespace std;

int main()
{
	int n;

	cout << "Enter the number :--> ";
	cin >> n;

	switch(n)
    {
        case 1:
            cout << "The day is Monday";
            break;

        case 2:
            cout << "The day is Tuesday";
            break;

        case 3:
            cout << "The day is Wednesday";
            break;

        case 4:
            cout << "The day is Thursday";
            break;

        case 5:
            cout << "The day is Friday";
            break;

    	case 6:
            cout << "The day is Saturday";
            break;

        case 7:
            cout << "The day is Sunday";
            break;

        default:
            cout << "Please enter the correct input (Between 1 and 7)";
    }
    return 0;
}

Output:

Run 1:
Enter the number :--> 7
The day is Sunday

Run 2:
Enter the number :--> 0
Please enter the correct inputs

≪ Previous | Next ≫