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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 13:00, alexacarillo
In excel - calculate the actual increase/decrease from first quarter to the second quarter then subtract subtract first quarter value from second quarter total then divide result by first quarter value
Answers: 1
image
Computers and Technology, 24.06.2019 02:10, ttangelique
Which sentences describe the things you need to ensure while creating a sketch and a drawing? while an artistic or creative drawing is a creative expression, a technical drawing is an informative expression. you need to create accurate and neat drawings to convey accurate information. a technical drawing clearly conveys its meaning or information, and does not leave room for interpretation maintain a good speed while creating drawings
Answers: 1
image
Computers and Technology, 24.06.2019 02:30, Esmail
Write the pseudo code for this problem based on what you learned from the video. the purpose is to design a modular program that asks the user to enter a distance in kilometers, and then converts that distance to miles. the conversion formula is as follows: miles = kilometers x 0.6214
Answers: 3
image
Computers and Technology, 24.06.2019 09:10, daedae11142
  to change the number of rows and columns displayed by the excel object a. select the object and drag a size handle on the active object. b. deselect the object and drag a size handle of the object. c. deselect the object and drag a row or column divider of the object. d. select the object and drag a row or column divider on the active object.
Answers: 2
You know the right answer?
In this laboratory, we are going to maintain a username-password system by storing the usernames and...

Questions in other subjects:

Konu
Chemistry, 17.02.2021 22:00