Advertisement
ItzEdInYourBed

enter_pin.cpp

May 16th, 2020
1,539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main() {
  4.  
  5.   int pin = 0;
  6.   int tries = 0;
  7.  
  8.   std::cout << "BANK OF CODECADEMY\n";
  9.  
  10.   std::cout << "Enter your PIN: ";
  11.   std::cin >> pin;
  12.  
  13.   while (pin != 1234 && tries <= 3) {
  14.    
  15.     std::cout << "Enter your PIN: ";
  16.     std::cin >> pin;
  17.     tries++;
  18.    
  19.   }
  20.  
  21.   if (pin == 1234) {
  22.    
  23.     std::cout << "PIN accepted!\n";
  24.     std::cout << "You now have access.\n";
  25.    
  26.   }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement