please help me with multidimensional arrays
Mar 6, 2014 at 4:53pm UTC
1. I have difficulties in getting the last column of my csv file. 7 rows and 6 columns. the 6th column is not going into data.
2. How do i return a multi dimensional array?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
string THIRDSTEP::DispSched(string movie)
{
string data[6][7];
ifstream file("C:\\Users\\User\\Desktop\\MP 116\\sched1.csv" );
for (int row = 0; row < 7; row++)
{
string line;
getline(file, line);
if (!file.good())
break ;
stringstream iss(line);
for (int col = 0; col < 6; col++)
{
string val;
getline(iss, val, ',' );
if (!iss.good())
break ;
stringstream converter(val);
converter >> data[row][col];
}
}
return 0;
}
Last edited on Mar 6, 2014 at 4:56pm UTC
Topic archived. No new replies allowed.