Advertisement
Guest User

qwe

a guest
Jul 23rd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int
  7. main()
  8. {
  9.  
  10. string uName;
  11.  
  12. string pWord;
  13.  
  14. string pWordC;
  15.  
  16. string uNameC;
  17.  
  18. int counter = 0;
  19.  
  20. char ch;
  21.  
  22. while (true)
  23.  
  24. {
  25.  
  26. cout << "Do you want to create a new Account?? (Y or N)";
  27.  
  28. cin >> ch;
  29.  
  30. if (ch == 'Y')
  31.  
  32. {
  33.  
  34. if (counter == 1)
  35.  
  36. {
  37.  
  38. cout << "You already created a Account";
  39.  
  40. return 0;
  41.  
  42. }
  43.  
  44. if (counter == 0)
  45.  
  46. {
  47.  
  48. cout << "Create a Username : ";
  49.  
  50. cin >> uNameC;
  51.  
  52. cout << "Create a Password : ";
  53.  
  54. cin >> pWordC;
  55.  
  56. counter++;
  57.  
  58. }
  59.  
  60. }
  61.  
  62. if (ch == 'N' && counter == 0)
  63.  
  64. {
  65.  
  66. cout << "You need an Account!";
  67.  
  68. return 0;
  69.  
  70. }
  71. cout << "Please login to your account" << endl << "---------------------------" << endl;
  72. cout << "Enter a user name ";
  73.  
  74. cin >> uName;
  75.  
  76. if (uName == uNameC)
  77.  
  78. {
  79.  
  80. cout << "Enter a password ";
  81.  
  82. cin >> pWord;
  83.  
  84. if (pWord == pWordC)
  85.  
  86. {
  87.  
  88. cout << "password correct!";
  89.  
  90. return 0;
  91.  
  92. } else
  93.  
  94. {
  95.  
  96. cout << "Password incorrect!" << endl;
  97.  
  98.  
  99.  
  100. }
  101.  
  102. }
  103.  
  104. if(uName != uNameC)
  105.  
  106. {
  107.  
  108. cout << "Username incorrect!" << endl;
  109.  
  110. }
  111.  
  112. }
  113.  
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement