//Read in name and year born from a file into a vector #include #include #include #include using namespace std; const int currentYear=2016; void getFile(vector &names,vector &yearBorn) { string input,yearString; ifstream people("c:/mycpp/names2.txt"); //input file stream if(people) { //file was opened while(getline(people,input)) { //Example: input="Jay 1994" int p=input.find_first_of(","); //Example: p=3 if(p>=0) { names.push_back(input.substr(0,p)); //Example: name="Jay" yearString=input.substr(p+1); // Example: yearString="1994" yearBorn.push_back(stoi(yearString)); //stoi=String To Int, Example yearBorn=1994 }//there was a comma }//each line people.close(); } }//getFile void showAll(vector names,vector yearBorn) { cout<<"NAME\tAGE\n"; int count=names.size(); for(int i=0;i names, string name) { int found=-1; int i=0; while(found<0 && i names; vector yearBorn; string lookfor; getFile(names,yearBorn); showAll(names,yearBorn); if(names.size()==0) cout<<"There was an error reading the file.\n"; else { cout<=0) cout<