Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions

Question

2. What should an employer do when facing an OSHA inspection?

Answered: 1 week ago