fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. string usernameIn, passwordIn;
  8. string username = "strings";
  9. string password = "rule";
  10. bool loggedIn = false;
  11.  
  12. do {
  13.  
  14.  
  15. cout << "username: ";
  16. cin >> usernameIn;
  17. if (usernameIn != username) {
  18. cout << "Noty found\n";
  19. continue;
  20. }
  21.  
  22. cout << "password: ";
  23. cin >> passwordIn;
  24. if (passwordIn != password) {
  25. cout << "Bad password\n";
  26. continue;
  27. }
  28.  
  29. loggedIn = true;
  30.  
  31.  
  32. } while (!loggedIn);
  33.  
  34. cout << "done.";
  35. // your code goes here
  36. return 0;
  37. }
Success #stdin #stdout 0s 3472KB
stdin
string
strut
strings
poo
strings
rule
stdout
username: Noty found
username: Noty found
username: password: Bad password
username: password: done.