Advertisement
Guest User

Untitled

a guest
May 26th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. // Log In
  2.  
  3. #include <iostream>
  4. #include <conio.h>
  5. #include <string>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. string InputUsername;
  12. string InputPassword;
  13. string Username = "";
  14. string Password = "";
  15. int attempt;
  16.  
  17. cout << "\tRegistration " << endl;
  18. cout << "\nWhat would you like to do?" << endl;
  19.  
  20. cout << "1. Register" << endl;
  21. cout << "2. Log in" << endl;
  22. cin >> attempt;
  23.  
  24. if (attempt = 1)
  25. {
  26. system ("cls");
  27. cout << "Please enter your username: ";
  28. cin >> Username;
  29. cout << "Please enter your password: ";
  30. cin >> Password;
  31. cout << "\n Registration complete" << endl;
  32. }
  33. if (attempt = 2)
  34. {
  35. cout << "What is your username?" << endl;
  36. cin >> InputUsername;
  37.  
  38. cout << "What is your password?" << endl;
  39. cin >> InputPassword;
  40.  
  41. system ("cls");
  42.  
  43. if (InputUsername == Username && InputPassword == Password)
  44. {
  45. cout << "Welcome " << Username << endl;
  46. }
  47. else
  48. {
  49. cout << "Invalid Log in attempt" << endl;
  50. }
  51. }
  52. else
  53. {
  54. cout << "Invalid option " << endl;
  55. }
  56.  
  57. _getch();
  58.  
  59. return 0;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement