Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <cstdlib>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. class czescCwelu
  9. {
  10.     string godnoscCzlowieka;
  11.  
  12. public:
  13.     void przywitajCwela()
  14.     {
  15.         cout << "Nazywasz sie: ";
  16.         getline(cin, godnoscCzlowieka);
  17.         for (int i = 0; i <= godnoscCzlowieka.length(); i++)
  18.         {
  19.  
  20.             if ( (godnoscCzlowieka[i] == ' ') || (i==godnoscCzlowieka.length()) )
  21.             {
  22.  
  23.                 if (godnoscCzlowieka[i-1] == 'a')
  24.                 {
  25.                     cout << "Witam szanowna Pania!\n\n"; break;
  26.                 }
  27.                 else
  28.                 {
  29.                     cout << "Witam szanownego Pana!\n\n"; break;
  30.                 }
  31.             }
  32.         }
  33.  
  34.     }
  35. };
  36.  
  37.  
  38. int main()
  39. {
  40.     for (;;)
  41.     {
  42.         czescCwelu Roman;
  43.         Roman.przywitajCwela();
  44.     }
  45.  
  46.     system("pause");
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement