Advertisement
Guest User

Untitled

a guest
Sep 11th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <string>
  4. #include <stdio.h>
  5. #include <windows.h>
  6. #include<time.h>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12. string userName;
  13. string userPassword;
  14. int loginAttempt = 0;
  15.  
  16. SetConsoleTitle(L"SHOCKWAVE");
  17.  
  18. while (loginAttempt < 3)
  19. {
  20. system("cls");
  21. printf("Release Date: %s @ %s\n", __DATE__, __TIME__);
  22. cout << "Please enter your user name: ";
  23. cin >> userName;
  24. cout << "Please enter your user password: ";
  25. cin >> userPassword;
  26.  
  27. if (userName == "Miki" && userPassword == "1337")
  28. {
  29. system("cls");
  30. cout << "Welcome Miki!\n";
  31. break;
  32. }
  33. else if (userName == "Fanta" && userPassword == "1337")
  34. {
  35. system("cls");
  36. cout << "Welcome Fanta!\n";
  37. break;
  38. }
  39. else if (userName == "SMOVE" && userPassword == "1337")
  40. {
  41. system("cls");
  42. cout << "Welcome SMOVE!\n";
  43. break;
  44. }
  45. else
  46. {
  47. cout << "Invalid login attempt. Please try again.\n" << '\n';
  48. loginAttempt++;
  49. }
  50. }
  51. if (loginAttempt == 3)
  52. {
  53. system("cls");
  54. cout << "Too many login attempts! The program will now terminate." << std::endl;
  55. system("pause");
  56. return 0;
  57. }
  58.  
  59. cout << "Thank you for logging in.\n";
  60. system("pause");
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement