Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Magdalaga, June Lei Angelo A. | CE12S4 | M2: Assignment 2.

2 The Switch Statement Selection Control Structure

#include <iostream>
using namespace std;
int main() {

int x;
cout << "Enter number from 1-7: ";
cin >> x;

switch (x) {
case 1: cout << "\nYou have entered 1, which corresponds to the first day of the week which is Sunday.";
break;

case 2: cout << "\nYou have entered 2, which corresponds to the second day of the week which is Monday.";
break;

case 3: cout << "\nYou have entered 3, which corresponds to the third day of the week which is Tuesday.";
break;

case 4: cout << "\nYou have entered 4, which corresponds to the fourth day of the week which is Wednesday.";
break;

case 5: cout << "\nYou have entered 5, which corresponds to the fifth day of the week which is Thursday.";
break;

case 6: cout << "\nYou have entered 6, which corresponds to the sixth day of the week which is Friday.";
break;

case 7: cout << "\nYou have entered 7, which corresponds to the seventh day of the week which is Saturday.";
break;

default: cout << "\nInvalid";}

return 0;

"I affirm that I have not given or received any unauthorized help on this assignment and that this work is my own.”
FlowChart

"I affirm that I have not given or received any unauthorized help on this assignment and that this work is my own.”

You might also like