here is sample data:
*CSC121
John Jones
Mary Kelly
*MTH453
Mary Kelly
James Johnson
Given a collection of class rolls, this program allows the advisor
to extract a list of all the courses taken by a given student. */
#include <iostream>
#include <iomanip>
#include <fstream>
#include <strstream>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
Code:
int main()
{
string filename;
string str;
string Name;
vector<string> studentName;
vector<string> course;
cout<<"Please enter the file name where the class rolls are stored:"<<endl;
cin>>filename;
ifstream istr(filename.c_str());
while ( getline(istr, str) ) {
istringstream istr(str.c_str());
cin >> str;
while (str != "*"){
studentName.push_back(str);
cin >> str;
}
}
while (str == "*"){
course.push_back(str);
cin >> str;
}
cout<<"Enter the first name, a space, and last name of the student you are searching for:"<<endl;
cin<<Name;
can anyone shed any light on this??