How can I have 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
  #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;
}
@spring2014

You're not sending the newline to the saved file, just to screen. Add a outputFile<<endl; before or after your cout << endl;
Lots of thankssssssssssssssssssssss
Topic archived. No new replies allowed.