Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int
- main()
- {
- string uName;
- string pWord;
- string pWordC;
- string uNameC;
- int counter = 0;
- char ch;
- while (true)
- {
- cout << "Do you want to create a new Account?? (Y or N)";
- cin >> ch;
- if (ch == 'Y')
- {
- if (counter == 1)
- {
- cout << "You already created a Account";
- return 0;
- }
- if (counter == 0)
- {
- cout << "Create a Username : ";
- cin >> uNameC;
- cout << "Create a Password : ";
- cin >> pWordC;
- counter++;
- }
- }
- if (ch == 'N' && counter == 0)
- {
- cout << "You need an Account!";
- return 0;
- }
- cout << "Please login to your account" << endl << "---------------------------" << endl;
- cout << "Enter a user name ";
- cin >> uName;
- if (uName == uNameC)
- {
- cout << "Enter a password ";
- cin >> pWord;
- if (pWord == pWordC)
- {
- cout << "password correct!";
- return 0;
- } else
- {
- cout << "Password incorrect!" << endl;
- }
- }
- if(uName != uNameC)
- {
- cout << "Username incorrect!" << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement