Advertisement
desislava_topuzakova

01. Day of Week

Jan 23rd, 2022
576
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int number;
  7.     cin >> number;
  8.  
  9.     //1 -> Monday
  10.     //2 -> Tuesday
  11.     //3 -> Wednesday
  12.     //4 -> Thursday
  13.     //5 -> Friday
  14.     //6 -> Saturday
  15.     //7 -> Sunday
  16.     //other -> Error
  17.  
  18.     //серия от проверки за цяло число за точни стойности -> switch
  19.     switch (number)
  20.     {
  21.         case 1:
  22.             cout << "Monday";
  23.             break;
  24.         case 2:
  25.             cout << "Tuesday";
  26.             break;
  27.         case 3:
  28.             cout << "Wednesday";
  29.             break;
  30.         case 4:
  31.             cout << "Thursday";
  32.             break;
  33.         case 5:
  34.             cout << "Friday";
  35.             break;
  36.         case 6:
  37.             cout << "Saturday";
  38.             break;
  39.         case 7:
  40.             cout << "Sunday";
  41.             break;
  42.         default:
  43.             cout << "Error";
  44.             break;
  45.     }
  46.  
  47.  
  48.     return 0;
  49. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement