Question: My program needs to read into a lines.txt that says 0 a a b c 0 b b e f 1 c c h i

 My program needs to read into a lines.txt that says 0

My program needs to read into a lines.txt that says

0 a a b c 0 b b e f 1 c c h i 2 d d k l

and then output a table like

0:a b c |b e f |- - - |- - - | 1:- - - |- - - |c h i |- - - | 2:- - - |- - - |- - - |d k l |

I am currently just on a function for reading the lines.txt file and putting the data into vectors. I am stuck on how to set a b c, b e f, c h i, d k l into the vector T[row][col].

The function will also not run unless I return a value, but I am unsure at the moment what I should return.

// this reads the input file into the matrix table lint readTable() { int row, col; char col_c; ifstream fin("lines.txt", ios::in); // Read in the file into I while (fin >> row) // per row { fin >> col_c; col = convert(col_c); // to a slot number vector v; // a vector to fill char c; // one char from the file // ** Fill v with chars from the file (a for loop) for (int i = 0; i > C; v.push_back(c); //T[row][col].push_back(c); } // ** Put v in T[row][col] //T[row][col] = v; //cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!