Advertisement
Guest User

Is efficient?

a guest
Sep 16th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. void UserpassFunc()
  7. {
  8. string username;
  9. int password;
  10. bool success = 0;
  11. while (success == 0)
  12. {
  13. cout << "Please enter your username: ";
  14. cin >> username;
  15. cout << "Please enter your password: ";
  16. cin >> password;
  17.  
  18. if (username == "delcari" && password == 123 || username == "Azex" && password == 456)
  19. {
  20. cout << "Access Granted";
  21. success = 1;
  22. }
  23. else
  24. {
  25. cout << "Access Denied\n";
  26. success = 0;
  27. }
  28. }
  29. }
  30.  
  31. int main()
  32. {
  33. UserpassFunc();
  34. cin.ignore();
  35. cin.get();
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement