+1

# multidimensional array

void build_pascal(int p[][SIZE], int n); void showmatrix(int p[][SIZE], int n); const int SIZE=100; int main() { int n; cout<<"Enter the number of rows for pascal triangle size: "; cin>>n } void build_pascal(int p[][SIZE], int n) { assert(n>0 && n<SIZE); for(int i=0; i<SIZE; i++) { for(int j=0; j<SIZE; j++) { if(i>n || j>i) { p[i][j] = 0; } else if(j==0 || j==i) { p[i] [j] =1; } else { p[i][j] = p[i-1][j-1]+p[i-1][j]; } } } showmatrix(p,n); } void showmatrix(int p[][SIZE], int n) { for(int i=0; i<SIZE; i++) { for(int j=0; j<SIZE; j++) { cout<<p[i][j]<<"\t"; } cout<<endl; } cout<<endl; } I've done the code up to this and it's not completed .How can I write the matrix and relate the integer to it?

4/26/2021 10:32:10 AM

Ramisa Fariha

+1

https://code.sololearn.com/ca36A9a56A03 here is the code @Martin

+1

@Martin I' ve fixed those errors..Now what will be the next step?

+1

Thank you so much

0

the question was Write and test a function that creates Pascal’s Triangle in the square matrix that is passed to it. For example, if the two-dimensional array a and the integer 4 were passed to the function, then it would load the following into a: 10000 11000 12100 13310 14641