Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <cstdlib>
- #include <string>
- using namespace std;
- class czescCwelu
- {
- string godnoscCzlowieka;
- public:
- void przywitajCwela()
- {
- cout << "Nazywasz sie: ";
- getline(cin, godnoscCzlowieka);
- for (int i = 0; i <= godnoscCzlowieka.length(); i++)
- {
- if ( (godnoscCzlowieka[i] == ' ') || (i==godnoscCzlowieka.length()) )
- {
- if (godnoscCzlowieka[i-1] == 'a')
- {
- cout << "Witam szanowna Pania!\n\n"; break;
- }
- else
- {
- cout << "Witam szanownego Pana!\n\n"; break;
- }
- }
- }
- }
- };
- int main()
- {
- for (;;)
- {
- czescCwelu Roman;
- Roman.przywitajCwela();
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement