This method is pretty good. You could make it faster by

taking out the recursion and indexing a 2-d array.

Writing it so that it offsets it with | perfectly seems a little

tough because at some point your pascal coeff will mess up the offsets. The easiest way to do this looks like to calculate one row for example 1 6 15 20 15 6 1 and then the number of spaces it occupies 16.

Code:

#include <iostream>
using std::cout;
using std::endl;
int pascal(int row, int col)
{
if (row == 0 || col == 0 || row == col + 1)
return 1;
return pascal(row - 1, col - 1) + pascal(row - 1, col);
}
int main(void)
{
for (int i = 0; i < 10; ++i) {
for (int j = 0; j < i; ++j)
cout << pascal(i, j) << " ";
cout << endl;
}
return 0;
}