Hi everyone, I want to make a program that asks you to set a username and password (save it into a file) and after that, each time that the program is opened ask you to provide the username and password. The main problem is to handle unlimited (at least more than 5) users at a time(in a single file).
I'd suggest that at the beginning of the program you open the fstream, read user, pass into a map.
in LogIn() you can easily find the user and match against the password.
in Register() you need to check if the user exists (if so you tell the user he can't use that name). If everything is ok write the newly entered values line by line at the end of the file.
in Register() you need to check if the user exists (if so you tell the user he can't use that name). If everything is ok write the newly entered values line by line at the end of the file.
Ok but how to write and read it? How to separate the lines and understand it? That's my problem