I have a file in the format: FirstName,MiddleName,LastName,Major,City,State,GPA
I'm trying to read in the file and output the data without the commas to the screen. This is what I have so far, but it only outputs the GPA's:
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main(){
string fileline;
string word;
ifstream studentData;
studentData.open("studentData.csv");
while(studentData){
getline(studentData,fileline);
istringstream ss(fileline);
while(getline(ss, word,','));{
cout << word << '\n';
}
}
return(0);
}