Why the txt output is different that compiler screen?

Dear Friends,
This codes read 9 numbers from a .txt file and writes the results in another txt file. ut I do not know why the what compiler show in screen in different that the what is written in txt file I mean:
The input data and style is
2
3
4
5
6
7
8
9
10
the what screen show
203040
506070
8090100

the what I see in txt file:
2030405060708090100

I want to see the complier screen data style(I mean 3*3 table) in txt file. would you please help me?

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
      #include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;

int acc(int x)
{
    return (10*x);
}

int main()
{
      //reading 9 items from file, assume the file has upto 9 items
    int array[3][3];

    ifstream inputFile("afile.txt");  //ive not checked if the file exists
    ofstream outputFile("output.txt");

    //read from file
    int a;
    for(int i = 0; i < 3; i++)
    {
        for(int j = 0; j < 3; j++)
        {
            inputFile>>a;
            array[i][j] = acc(a);
        }
    }

    //print to file
    for(int i = 0; i < 3; ++i)
    {
        for(int j = 0; j < 3; ++j)
        {
        	if(j%3== 0)
        	cout<<endl;
        	cout<<array[i][j];
        	outputFile<<array[i][j];
        }
    }

    return 0;
}
Topic archived. No new replies allowed.