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 hacc;
- string hem2;
- string hpass2;
- int hid2;
- string hacc2;
- int hid;
- int ch = 0;
- int loop = 1;
- while (loop == 1) {
- loop = 0;
- cout << "Welcome to the website!\n\nWould you like to\n1. login\n2. register\n";
- cin >> ch;
- if (ch == 2) {
- cout << "Thank you for regsistering with us!\n\nPlease enter an email:\n";
- cin >> hem;
- cout << "Please enter a password:\n";
- cin >> hpass;
- hacc = hem + " " + hpass;
- accinfo.push_back(hpass);
- cout << "Registration complete!\n";
- hid = accinfo.size() + 1;
- cout << "Your id is " << hid << "\n";
- cout << accinfo.size();
- loop = 1;
- }
- else if (ch == 1) {
- cout << "Please enter your id:\n";
- cin >> hid2;
- hid2 = hid2 - 1;
- cout << "Please enter your email:\n";
- cin >> hem2;
- cout << "Please enter your password:\n";
- cin >> hpass2;
- hacc2 = hem2 + " " + hpass2;
- if (hacc2 == accinfo[hid2]) {
- cout << "Login succesful!\n";
- return 0;
- }
- else if (hacc2 != accinfo[hid2]) {
- cout << "Login failed! Invalid ID?\n";
- loop = 1;
- }
- }
- else {
- cout << "Invalid option\n";
- loop = 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement