i'm reading file which has some number of columns each line has different number of columns and they are numerical values of different length, and i have fix number of rows (20) how to put each column in to array?
suppose i have data file like following (there is tab between each column)
20 30 10
22 10 9 3 40
60 4
30 200 90
33 320 1 22 4
how to put these columns into different array,, that column 1 goes to one arrary and column 2 goes to another. Only column 2 has more than 2 digit values and the rest of columns has 1 or two digit values, and some columns are null too except 1, 2, and 3
int main()
{
ifstream infile;
infile.open("Ewa.dat");
int c1[20], c2[20], ... c6[20];
while(!infile.eof()) {
//what will be the code here?
infile >>lines;
for(int i = 1; i<=lines; i++) {
infile >> c1[i];
infile >> c2[i];
.
.
infile >> c6 [20];
}
}
}