Advertisement
Guest User

Untitled

a guest
Aug 13th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h>
  3. #include <string>
  4.  
  5.  
  6.  
  7.  
  8. using namespace std;
  9.  
  10. string repeatPassword() {
  11.  
  12.  
  13.  
  14. string checkPassword;
  15.  
  16. std::cout << "Repeat password: ";
  17. getline(cin, checkPassword);
  18. system("CLS");
  19.  
  20.  
  21.  
  22. return checkPassword;
  23.  
  24.  
  25. }
  26.  
  27. string registerAccount() {
  28.  
  29. string password;
  30. string username;
  31.  
  32. std::cout << "Register" << std::endl;
  33. std::cout << "Username: ";
  34. getline(cin, username);
  35. system("CLS");
  36. std::cout << "Password: ";
  37. getline(cin, password);
  38. system("CLS");
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46. return password;
  47.  
  48. }
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55. string checkIfSame() {
  56.  
  57.  
  58.  
  59. string password1 = registerAccount();
  60. string password2 = repeatPassword();
  61.  
  62.  
  63. if (password1 == password2) {
  64.  
  65. std::cout << "Account created";
  66. Sleep(1500);
  67. system("CLS");
  68. std::cout << "Going to login";
  69. Sleep(2000);
  70. system("CLS");
  71.  
  72. }
  73. else {
  74.  
  75. std::cout << "Login failed - Passwords are the same!";
  76. Sleep(3000);
  77. system("CLS");
  78.  
  79. checkIfSame();
  80.  
  81. }
  82.  
  83.  
  84.  
  85. }
  86.  
  87. void login() {
  88.  
  89. checkIfSame();
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96. }
  97.  
  98.  
  99.  
  100. int main() {
  101.  
  102.  
  103. login();
  104.  
  105.  
  106.  
  107.  
  108. return 0;
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement