You can use the std::setw manipulator for cout.
Here is also std::setfill to indicate the filler, but by default it has spaces.
If you want to center the values, you have to calculate a little. I would suggest proper alignment of values, because they are numbers (and this is simpler).
cout << '|' << setw(10) << value << '|' setw(10) << value2 << '|' << endl;
Remember to include <iomanip> .
It would not be easy to wrap this in a common table formatting function, but I will leave this as an exercise for the reader :)
Joshd source share