Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- main()
- {
- int code;
- string username, password;
- do
- {
- //Main Menu
- system("cls");
- cout << "--Main Menu--" << endl;
- cout << "[1]Login" << endl;
- cout << "[2]Exit" << endl;
- cout << "\n\nEnter choice: ";
- cin >> code;
- if(code == 1)
- {
- system("cls");
- cout << "--Login Menu--";
- cout << "\n\nEnter username: ";
- cin.ignore();
- getline(cin, username);
- cout << "Enter password: ";
- getline(cin, password);
- if(username == "user" && password == "pass")//validation
- {
- cout << "Login successfully." << endl;
- system("pause");
- do
- {
- system("cls");
- cout << "You are so handsome!" << endl;
- cout << "Do you want to logout? Press 1: ";
- cin >> code;
- if(code == 1)
- {
- }
- else//0 below, 2 above
- {
- cout << "Invalid response." << endl << endl;
- system("pause");
- system("cls");
- }
- }
- while(code != 1);//
- }
- else
- {
- cout << "Invalid username/password." << endl;
- }
- system("pause");
- }
- else if(code == 2)//Exit
- {
- cout << "Thank you for using! Exiting...";
- }
- else//3 above, 0 below
- {
- cout << "Invalid choice." << endl << endl;
- system("pause");
- }
- }
- while(code != 2);//1
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement