Advertisement
MeehoweCK

Untitled

Jul 17th, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3.  
  4. using namespace std;
  5.  
  6. bool taknie()
  7. {
  8.     char znak;
  9.     do
  10.     {
  11.         znak = getch();
  12.     } while(znak != 't' && znak != 'n' && znak != 'T' && znak != 'N');
  13.     if(znak == 't' || znak == 'T')
  14.         return true;
  15.     return false;
  16. }
  17.  
  18. int main()
  19. {
  20.     cout << "Wybierz tak czy nie (t/n): ";
  21.     /*char znak;
  22.     cin >> znak;
  23.     if(znak == 't')
  24.         cout << "Wybrales tak" << endl;
  25.     if(znak == 'n')
  26.         cout << "Wybrales nie" << endl;*/
  27.     if(taknie())
  28.         cout << "Wybrales tak" << endl;
  29.     else
  30.         cout << "Wybrales nie" << endl;
  31.  
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement