Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- char username[30];
- char password[30];
- char userinputname[30];
- char userinputpass[30];
- using namespace std;
- void registeruser () {
- cout << "Desired username (only up to 30 characters): ";
- cin >> username;
- cout << "\n\n";
- cout << "Desired password (only up to 30 characters): ";
- cin >> password;
- }
- void login () {
- cout << "Username: ";
- cin >> userinputname;
- cout << "\n\n";
- cout << "Password: ";
- cin >> userinputpass;
- cout << "\n\n";
- if (userinputname == username && userinputpass == password) {
- cout << "Login success!";
- }
- else {
- cout << "Login failure.";
- }
- }
- int main () {
- string answer;
- cout << "Hello, and welcome to login v1.0\n\n";
- cout << "Do you have an account yet: ";
- cin >> answer;
- if (answer == "yes") {
- login();
- }
- else if (answer == "no") {
- registeruser();
- cout << "\n\n";
- login();
- }
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement