#include <vector>
#include <iostream>
using namespace std;
vector<vector<int> > generate(int numRows) {
if (numRows <= 0) {
return vector<vector<int> >();
}
vector<vector<int> > result(numRows, vector<int>());
result[0].push_back(1);
for (int i = 1; i < numRows; ++i) {
result[i].resize(i+1, 1);
for (int j = 1; j < i; ++j) {
result[i][j] = result[i-1][j-1] + result[i-1][j];
}
}
return result;
}
void printVV(vector<vector<int> > vv) {
size_t si = vv.size();
for (int i = 0; i < si; ++i) {
vector<int> &v = vv[i];
size_t sj = v.size();
for (int j = 0; j < sj; ++j) {
cout << v[j] << ", ";
}
cout << endl;
}
}
int main (int argc, const char * argv[]) {
cout << "Pascal's Triangle of 7:" << endl;
printVV(generate(7));
cout << endl << "Pascal's Triangle of 21:" << endl;
printVV(generate(21));
return 0;
}