Advertisement
desislava_topuzakova

04. Personal Titles

Jan 23rd, 2022
607
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.     double age;
  7.     cin >> age;
  8.  
  9.     char gender;
  10.     cin >> gender;
  11.  
  12.     //1. проверка за пола
  13.     if (gender == 'm') {
  14.         //проверка за възрастта
  15.         if (age >= 16)
  16.         {
  17.             cout << "Mr.";
  18.         }
  19.         else //age < 16
  20.         {
  21.             cout << "Master";
  22.         }
  23.     }
  24.     else if (gender == 'f')
  25.     {
  26.         //проверка за възрастта
  27.         if (age >= 16)
  28.         {
  29.             cout << "Ms.";
  30.         }
  31.         else  //age < 16
  32.         {
  33.             cout << "Miss";
  34.         }
  35.  
  36.     }
  37.     return 0;
  38. }
  39.  
  40.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement