I'm currently trying to program a code to run a login system. Which contains
1) Current Username
2) Current Password
3) New Username
5) New Password
there after the data will be saved into a textfile. I'm currently stuck in trying to get program to compare both username and password if both are true. User will then "enter" otherwise "try again".
Line 41: line is initialized to " " at line 10. You then try to parse _username and _password from line. You don't want to parse line until after you've read something into it.
Move line 42 to line 46.
Line 54: You don't want to display "Invalid username and password" until after you've read the entire file.
Delete line 54.
Add after line 56:
1 2
if (! found)
cout<<"Invalid Username and Password"<<endl;