Advertisement
Guest User

Untitled

a guest
Nov 8th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. const int CAPASITY = 2;
  9. string username[CAPASITY];
  10. string password[CAPASITY];
  11.  
  12. bool userCheck;
  13. cout << "Please create a username: ";
  14. cin >> username[0];
  15. cout << "Please create a password: ";
  16. cin >> password[0];
  17.  
  18.  
  19. do{
  20.  
  21. cout << "Please enter your username : ";
  22. cin >> username[1];
  23. cout << "Please enter your password : ";
  24. cin >> password[1];
  25. if (username[0] == username[1])
  26. {
  27. if (password[0] == password[1])
  28. {
  29. cout << "Username and password is correct!" << endl;
  30. cout << "Access..." << endl;
  31. userCheck = true;
  32. }
  33.  
  34. }
  35. else if (username[0] != username[1] || password[0] != password[1])
  36. {
  37. userCheck = false;
  38. cout << "Username and password is wrong." << endl;
  39. cout << "Access is denied... Try again!!" << endl;
  40. }
  41.  
  42.  
  43. } while (!userCheck );
  44. cout << "hello world" << endl;
  45.  
  46.  
  47. return 0;
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement