multiplication table, in .txt output?

Dear Friends,
Would you please help me why the txt output is not in table shape?
But the compiler screen show is in table shape?

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
    #include <iostream>
#include <fstream>
#include <iomanip>

using namespace std;




int main()
{
 const int maxCount = 4;
 const int width = 6;
 int row;
 int column;
 ofstream outputFile("output.txt");
 for(row=1;row<=10;row++)
 {
   for(column = 1; column <= maxCount; column++)
     {
     cout << setw(width) << row * column;
     outputFile<<setw(width) << row * column;
     }
   cout << endl;

 }

 return 0;
}
What fond do you use in your txt viewer? Make sure it is monospace one.
Topic archived. No new replies allowed.