Homework Help Question & Answers
1. Create a program to verify a user name and password given by a user 2….
1. Create a program to verify a user name and password given by a user 2. Create a text file named “correctData.txt” (You will NOT upload this file during submission). Place a username on line 1 in the txt file and a password on line 2 in the file. This will be used for testing. 3. Create the following functions and call them starting from main: • void login () – This function is responsible for displaying the prompts asking for user name and password. It will only allow a user to attempt a password 3 times for security measures before returning back to main. You will need to use a loop to accomplish this task. • bool checkCredentials (string username, string password)- In order to validate the username and password. This is a boolean return and will return true or false from this function if the data verified does not match the file. • You will need to use fstream to create an instance of a file using ifstream. Compare the strings to the data in the text file. Remember, the username will be on line 1 in the text file and the password will be on line 2. Remember: 1. Close the fstream file before returning 0 2. Prototype functions. 3. Don’t use global variables When completed, upload the.cpp file only! Don’t worry about uploading the .txt file. I will supply that when grading.
GA. C:Windowssystem32cmd.exe Login Username :MyName Jeff Password:11111111 Invalid username or password. You have 2 remaining. Login Username: Hulk Password: Smash Invalid username or password. You have 1 remaining. Login Username : DarthVader Password:Force Choke Attempts exceeded. Press any key to continue CorrectData.txt + x Source.cpp Brittney a1234567 x G. C:Windowssystem32cmd.exe Login Username: Brittney Password:a1234 Invalid username or password. You have 2 remaining. Login Username :Brittney Password: a1234567 Login successful! Press any key to continue
Add a comment