Advertisement
Spocoman

01. Day of Week

Nov 17th, 2023
858
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n;
  7.     cin >> n;
  8.  
  9.     string weekDays[8] = {
  10.         "Invalid day!",
  11.         "Monday",
  12.         "Tuesday",
  13.         "Wednesday",
  14.         "Thursday",
  15.         "Friday",
  16.         "Saturday",
  17.         "Sunday"
  18.     };
  19.  
  20.     cout << weekDays[(n > 0 && n < 8 ? n : 0)] << endl;
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement