Row is user-inputted.
cout << "Input the number of rows: ";
cin >> row;
column=row;
int triangle[row][column];
for (i=0;i<=row;i++){
for (j=0;j<=column;j++){
triangle[i][j]=0;
}
}
for (i=0;i<=row;i++){
for (j=0;j<=i;j++){
if (j==0 || j==i){
triangle[i][j]=1;
} else {
triangle[i][j]=triangle[i-1][j]+triangle[i-1][j-1];
}
}
}
cout << "Pascals triangle with " << row << " rows.";
for (i=0;i<=row;i++){
for (j=0;j<=i;j++){
cout << triangle[i][j] << "\t";
}
cout << endl;
}
It does give out proper results when the row is seven, but it somehow crashes when the inputted row is greater than 8.