Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***************************************
- SINGLE USER LOGIN SYSTEM
- By Jacob Blair
- ***************************************/
- #include <iostream>
- using namespace std;
- int
- main ()
- {
- string mypass = "";
- string myemail = "";
- string epass = "";
- string email = "";
- bool reg = false;
- int ch = 0;
- int hom = 0;
- hom = 1;
- while (hom == 1)
- {
- hom = 0;
- cout << "Would you like to login or register? (1/2)\n";
- cin >> ch;
- if (ch == 2 && mypass == "" && myemail == "")
- {
- cout << "Thank you for registering with us!\n\n";
- cout << "Please enter your email\n";
- cin >> myemail;
- cout << "Email registered\nPlease enter a password\n";
- cin >> mypass;
- cout << "Successfully registered!\n";
- hom = 1;
- }
- else if (ch == 2 && mypass != "")
- {
- cout << "Already registered!\n";
- hom = 1;
- }
- else if (ch == 2 && myemail != "")
- {
- cout << "Already registered!\n";
- hom = 1;
- }
- else if (ch == 1 && mypass != "" && myemail != "")
- {
- cout << "Enter password\n";
- cin >> epass;
- if (epass != mypass)
- {
- cout << "Invalid password\n";
- hom = 1;
- }
- else
- {
- cout << "Enter email\n";
- cin >> email;
- if (email != myemail)
- {
- cout << "Invalid email\n";
- hom = 1;
- }
- else
- {
- if (epass == mypass && email == myemail)
- {
- cout << " Successfully logged in ! ";
- }
- else
- {
- cout << " Incorrect login.";
- }
- }
- }
- }
- else if (ch == 1 && mypass == " ")
- {
- cout << " Not registered ! \n ";
- hom = 1;
- }
- else if (ch == 1 && myemail == " ")
- {
- cout << " Not registered ! \n ";
- hom = 1;
- }
- else {
- cout << " Invalid option. \n ";
- hom = 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment