cout > aligning & arrangement (like table)

Hi,
I used normal cout to get the header & For-Loop to get the results.
But all results are not same, some have few character, some a lot
so its not arranging, aligning nicely.
like in html web language we can use <table> feature to get this done..
how can i do this in c++ ??

i want a result like this:

http://i45.tinypic.com/24xjll0.jpg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// example on insertion
#include <iostream>
using namespace std;

int main () {

  char str[] = "Test sentence";
  int val = 65;
  char ch = 'A';

  cout << str << endl;     // Insert string

  cout << ch << endl;      // Insert single character

  cout.width (10);
  cout << right;           // Insert manipulator

  cout << val << endl;     // Insert integer

  return 0;
}

Source: http://www.cplusplus.com/reference/iostream/ostream/operator%3C%3C/
Topic archived. No new replies allowed.