fork download
  1. #include <string>
  2. #include <iostream>
  3.  
  4. int main() {
  5. std::cout << "--Bank Account Database--" << std::endl;
  6. const auto psw = std::string("wfadmin");
  7. auto pin = std::string("");
  8. while (std::cout << "Enter password: ") {
  9. std::cin >> pin;
  10. if (pin != psw)
  11. std::cout << "\nWrong Password. Try Again.\n";
  12. else
  13. break;
  14. }
  15. std::cout << "password was: " << pin << '\n';
  16. }
  17.  
Success #stdin #stdout 0.01s 5448KB
stdin
wrong
still wrong
wfadmin
stdout
--Bank Account Database--
Enter password: 
Wrong Password. Try Again.
Enter password: 
Wrong Password. Try Again.
Enter password: 
Wrong Password. Try Again.
Enter password: password was: wfadmin