Problem A: Looking through data (20 points) (in c++) Download peopleData.txt and
ID: 3677415 • Letter: P
Question
Problem A: Looking through data (20 points) (in c++)
Download peopleData.txt and look through it (you can also rename it peopleData.csv to open in excel or some spreadsheet app). Write a program that reads this file then finds and displays on the username and password, if that line has one in the format “[username] : [password]”. This should be repeated until the end of the file (without displaying the last one twice!). You cannot assume the username will always be in the same place (or that it exists for a person at all). You may assume that if there is a username, then there will be a password (but again, you should not assume where it is located in the line). You do not need to check and see if the file properly exists here.
Example 1 (generated from peopleData.txt):
Herch1955 : ahg7aa9Kei
Ardsomal : aiCoh6Chi
Felich : eiHee3ie
Therstion : AeTai9ien3ie
Wittiptacked : ha8Thufah
Hisaim : Oocaing8
Explanation / Answer
#include bool found = false; string line = " "; ifstream readFilehere("peopledata.txt");//reading file string UserName; string Password; string _UserName; string _Password; cout > UserName; cout > Password; while (getline(readFilehere,line)) //reading till end of tile { stringstream is(line); is >> _UserName >> _Password; //comparing input username and original username in the format If(line==”[username]:[password]”) if (UserName == _UserName && Password == _Password) { coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.