I want to read an input file and print it in a output file by using 2D array . I
ID: 3771230 • Letter: I
Question
I want to read an input file and print it in a output file by using 2D array .
Input file:
ID Score1 score2 score3
12345 1.2 1.2 1.2
12312 1.2 1.2 1.2
12313 1.2 1.2 1.2
//my codes
...
{
for(int i=0 ; i<3 ; i++)
{
for(int j=0 ; j<=i ; j++)
input_file>>id[i][j];
{
for(int k=0 ; k<3 ; k++)
input_file>>score[i][k];
}
}
}
But it seem like my output file does not appear exactly like what in the input file.Anyone can help me why is this happen ?
Explanation / Answer
ifstream myfile; string file; string init[R_MAX][C_MAX]; int i, j, row, col; cout > file; myfile.open(file.c_str()); if(!myfile) { cout > col; for(i = 0; i init[i][j]; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.