Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- bool login(char username[], char password[])
- {
- cout << "\t\t Please login into the account\n";
- char * TMP_user_name = (char*)malloc(sizeof(char) * 20);
- char * TMP_password = (char*)malloc(sizeof(char) * 20);
- cout << "username:";
- cin >> TMP_user_name;
- cout << "password:";
- cin >> TMP_password;
- if (strcmp(username, TMP_user_name) && strcmp(password, TMP_password))
- {
- return false;
- }
- else {
- return true;
- }
- }
- int main()
- {
- const int size = 20;
- char username[size];
- char password[size] ;
- char mail[size];
- cout << "Enter your username :";
- cin >> username;
- cout << "Enter password :";
- cin >>password;
- cout << "Enter mail :";
- cin >> mail;
- if (login(username, password))
- {
- cout << "You logged in succsessfuly" << endl;
- }
- else {
- cout << "Wrong password or username";
- }
- cin.get();
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement