I WILL GIVE FULL RATING Write a short user login code in C++. Please follow thes
ID: 3612278 • Letter: I
Question
I WILL GIVE FULL RATINGWrite a short user login code in C++.
Please follow these guidelines:-
This should be simple. There should be a text file that containsuser names and their passwords. In the program, a message (onscreen) is displayed asking for user login name and password. Thepassword should be hidden, by *s as normal. If a user wants tologin, then the program can check if such user name exists (fromtextfile) or if there is such a user name, then check if thepassword is correct (by comparison). If no such user name existsthen a message e..g. "you are not relevant user" should appear. Ifuser login is correct but password is incorrect, then "wrongpassword" message should appear. I think that simple user logincode does not need "forgot password" option, so include it if youcan, else ignore it. If all is correct, then message "you havelogged in successfully" should be displayed. Then a message "if youwant to log out enter O" and if user enter "O", the message "youhave logged out sucessfully" appears, and the program ends.
Explanation / Answer
please rate - thanks used this data in a file named input.txt Alien, mars Amir, 123 ABC, xyz John, jkl Zed, zee #include #include #include using namespace std; int main() {ifstream input; string name,filename,filepw; char password[10],O; bool match=false,matchpw; string::size_type pos; int i,j,tries; input.open("input.txt",ios::in); while(match==false) { coutfilename; do {pos=filename.find(','); filename=filename.substr(0,pos); if(filename==name) match=true; input>>filepw; if(!match) input>>filename; }while(input&&!match); if(!match) coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.