subject

In this laboratory, we are going to maintain a username-password system by storing the usernames and passwords in a file. The file will consist of a single username and password per line with a space in between. 1. Begin by creating a class PasswordFile which has the following interface:
class PasswordFile
public:
PasswordFile(string filename); // opens the file and reads the names/passwords in the vectors user and password.
void addpw(string newuser, string newpassword); //this adds a new user/password to the vectors and writes the vectors to the file filename bool checkpw(string user, string passwd); // returns true if user exists and password matches
private:
string filename; // the file that contains password information
vector user; // the list of usernames
vector password; // the list of passwords
void synch(); writes the user/password vectors to the password file
The constructor accepts a filename, and reads the file one-line at a time and adds values to the vectors user and password. The function addpw adds a user/password pair to end of each vector.
2. Now create a password. txt file with some entries such as:
jsmith turtle
madams apple
Also create a main program to test your classes :
int main() PasswordFile passfile
("password. txt");
passfile. addpw("dbotting","123qwe");
passfile. addpw("egomez", "qwerty");
passfile. addpw("tongyu", "liberty");
// write some lines to see if passwords match users

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 00:30
Quick pl which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
question
Computers and Technology, 24.06.2019 15:30
What is the function of compilers and interpreters? how does a compiler differ from an interpreter?
Answers: 2
question
Computers and Technology, 24.06.2019 17:40
Create a file called favorite_foods, and list your favorite foods, entering five or six or more. press enter after each favorite food so it appears on its own line (make certain you also press enter after the final food item). after the file is created, add two more foods you like that are not on the list (press enter after the final food item). view the list of foods to make certain the two items you added appear at the end of the list
Answers: 2
question
Computers and Technology, 25.06.2019 05:40
How to make a negative number positive in excel
Answers: 3
You know the right answer?
In this laboratory, we are going to maintain a username-password system by storing the usernames and...
Questions
question
Mathematics, 07.01.2020 16:31
question
Biology, 07.01.2020 16:31
question
Social Studies, 07.01.2020 16:31
question
Mathematics, 07.01.2020 16:31
Questions on the website: 13722363