Write a c program that will prompt a user to enter a usernam

Write a c++ program that will prompt a user to enter a username and password. Validate the user\'s login before allow the use to advance. You must start out by having a datafile that has a list of ten (10) usernames and passwords. Possible login error messages for username: 1. Username not found Possible login error messages for password 1. Password not found 2. Password must contain eight (8) or more characters 3. Password must contain a special character 4. Password cannot have blank spaces 5. Password must have at least two numbers 6. Password must have at least one uppercase letter The program should prompt a user with a login screen. (Example) Enter Login ID: XXXXXXXXXX (if login is not found, display error message and loop until correct of the user chooses to exit.) The Enter Password: XXXXXXXXXXXXX (If the password not found, display error message and loop twice. If not successful after two attempts, write a login attempt log to a log file named \"ERROR LOG\" lf login attempt is successful, prompt the user with the following screen: 1. Add a User & Password 2. Update user password 3. Exit Enter your choice:

Solution

#include <iostream>

#include <string>

using namespace std;

int main()

{

                const string USERNAME = \"chegg\";

                const string PASSWORD = \"12345678\";

                string username, password;

                cout << \"Enter Username : \";

                cin >> username;

                if(username.length() < 4)

                {

                                cout << \"Username length must be atleast 4 characters long.\";

                }

                else

                {

                                cout << \"Enter Password : \";

                                cin >> password;

                                if(password.length() < 8)

                                {

                                                cout << \"Password length must be atleast 8 characters long.\";

                                }

                                else

                                {

                                                if(username == USERNAME && password == PASSWORD)

                                                {

                                                                cout << \"User credentials are correct!!!\" << endl;

                                                }

                                                else

                                                {

                                                                cout << \"Invalid login details\" << endl;

                                                }

                                }

                }

                return 0;

}

 Write a c++ program that will prompt a user to enter a username and password. Validate the user\'s login before allow the use to advance. You must start out by
 Write a c++ program that will prompt a user to enter a username and password. Validate the user\'s login before allow the use to advance. You must start out by

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site