Advertisement
_crimsonghost

Homework 20190917 - Pin

Sep 18th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int getPin();
  6. void repeatPin(int A);
  7.  
  8. int main()
  9. {
  10.     int Pin = getPin();
  11.     repeatPin(Pin);
  12.     system("PAUSE");
  13. }
  14.  
  15. int getPin()
  16. {
  17.     int Pin = 0;
  18.     cout << "Podaj pin: ";
  19.     cin >> Pin;
  20.     cout << endl;
  21.     return Pin;
  22. }
  23.  
  24. void repeatPin(int A)
  25. {
  26.     int B = 0;
  27.     int i;
  28.     for (i = 2; i >= 0; i--)
  29.     {
  30.         cout << "Powtorz pin: ";
  31.         cin >> B;
  32.         cout << endl;
  33.  
  34.         if (A != B)
  35.         {
  36.             cout << "Pin niepoprawny. Pozostalo prob: " << i;
  37.             cout << endl;
  38.             if (i == 0)
  39.             {
  40.                 cout << "Twoje konto zostalo zablokowane." << endl;
  41.             }
  42.         }
  43.  
  44.         else
  45.         {
  46.             cout << "Pin poprawny." << endl;
  47.             break;
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement