Advertisement
Ola_Imiolczyk

S2 Zad 11

Nov 15th, 2020
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     /*11.Napisz pogram, który pobiera cyfrę od 1 do 7
  8.         i zwraca słowną reprezentację dnia tygodnia
  9.         np. 1 -> poniedziałek, 2 ->wtorek…),
  10.         jeśli poda cyfrę spoza zakresu wyświetl komunikat o błędzie. */
  11.  
  12. int x;
  13.     cout<<"Podaj cyfre z zakresu od 1 do 7: ";
  14.     cin>>x;
  15.  
  16.     if(x==1)
  17.     {
  18.         cout<<"Poniedzialek";
  19.     }
  20.     else if(x==2)
  21.     {
  22.         cout<<"Wtorek";
  23.     }
  24.     else if(x==3)
  25.     {
  26.         cout<<"Sroda";
  27.     }
  28.     else if(x==4)
  29.     {
  30.         cout<<"Czwartek";
  31.     }
  32.     else if(x==5)
  33.     {
  34.         cout<<"Piatek";
  35.     }
  36.     else if(x==6)
  37.     {
  38.         cout<<"Sobota";
  39.     }
  40.     else if(x==7)
  41.     {
  42.         cout<<"Niedziela";
  43.     }
  44.     else
  45.     {
  46.         cout<<"Podales cyfre spoza zakresu";
  47.     }
  48.  
  49.  
  50.     return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement