河南成教 / 面向对象程序设计
22[分析题]
#include<iostream.h> void fun10(int *a[],int m,int n) { int i,j; for(i=0;i<m;i ) a[i]=new int [n]; for(i=0;i<m;i ) for(j=0;j<n;j ) a[i][j]=(i 1)*(j 1); } void main() {int m1=2,n1=2; int **b=new int *[m1]; fun10(b,m1,n1); for(int i=0;i<m1;i ){ for(int j=0;j<n1;j ) cout<<b[i][j]<<’ ’; cout<<endl; } }
22[分析题]
#include<iostream.h> void fun10(int *a[],int m,int n) { int i,j; for(i=0;i<m;i ) a[i]=new int [n]; for(i=0;i<m;i ) for(j=0;j<n;j ) a[i][j]=(i 1)*(j 1); } void main() {int m1=2,n1=2; int **b=new int *[m1]; fun10(b,m1,n1); for(int i=0;i<m1;i ){ for(int j=0;j<n1;j ) cout<<b[i][j]<<’ ’; cout<<endl; } }
参考答案:
佳题速递: