Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int
- main ()
- {
- vector < string > accinfo =
- {
- "admin admin"};
- string hpass = "";
- string hem = "";
- string facc = "";
- string phem = "";
- string phpass = "";
- string len = "";
- int a = 0;
- int b = 0;
- int lloop = 0;
- a = 1;
- while (a == 1)
- {
- a = 2;
- cout << "Welcome to the website!\n\n";
- cout << "Would you like to register or login?\n1) register\n2) login\n";
- cin >> b;
- if (b == 1)
- {
- cout << "Thank you for regsitering with us!\n\n";
- cout << "Please enter your email:\n";
- cin >> hem;
- cout << "Please enter a password:\n";
- cin >> hpass;
- if (hem != "" && hpass != "")
- {
- cout << "Registration complete!\n\n";
- facc = hem + " " + hpass;
- accinfo.push_back (facc);
- a = 1;
- }
- else
- {
- cout << "Invalid entry for: password/email\n";
- a = 1;
- }
- }
- else if (b == 2)
- {
- cout << "Login:\n\n";
- cout << "enter email:\n";
- cin >> phem;
- cout << "enter password:\n";
- cin >> phpass;
- len = phem + phpass;
- for (int i = 0; i < accinfo.size (); i++)
- {
- if (len == accinfo[i])
- {
- lloop = 1;
- while (lloop == 1)
- {
- lloop = 0;
- cout << "Succesful login!\n";
- }
- }
- else if (i < accinfo.size() && len != accinfo[i])
- {
- lloop = 1;
- }
- else if (i == accinfo.size() && len != accinfo[i])
- {
- cout << "Login failed";
- a == 1;
- }
- else if (i == accinfo.size() && len == accinfo[i])
- {
- cout << "Login Succesful";
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement