Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Log In
- #include <iostream>
- #include <conio.h>
- #include <string>
- using namespace std;
- int main()
- {
- string InputUsername;
- string InputPassword;
- string Username = "";
- string Password = "";
- int attempt;
- cout << "\tRegistration " << endl;
- cout << "\nWhat would you like to do?" << endl;
- cout << "1. Register" << endl;
- cout << "2. Log in" << endl;
- cin >> attempt;
- if (attempt = 1)
- {
- system ("cls");
- cout << "Please enter your username: ";
- cin >> Username;
- cout << "Please enter your password: ";
- cin >> Password;
- cout << "\n Registration complete" << endl;
- }
- if (attempt = 2)
- {
- cout << "What is your username?" << endl;
- cin >> InputUsername;
- cout << "What is your password?" << endl;
- cin >> InputPassword;
- system ("cls");
- if (InputUsername == Username && InputPassword == Password)
- {
- cout << "Welcome " << Username << endl;
- }
- else
- {
- cout << "Invalid Log in attempt" << endl;
- }
- }
- else
- {
- cout << "Invalid option " << endl;
- }
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement