if(i%2==0) {
cout<
cout< 2、打印一个三角形的1~9的乘法表。 #include for(i=1;i<=9;i++) { 共29 页,第 6页 for(j=1;j<=i;j++) { s=i*j; cout< cout< ??578?????4?23?????2?24?394??????111???8?12???????。 3、编程求矩阵的加法: #include int a[3][3]={5,7,8,2,-2,4,1,1,1},b[3][3]={4,-2,3,3,9,4,8,-1,2},c[3][3]; for(i=0;i<3;i++) 共29 页,第 7页 { for(j=0;j<3;j++) { c[i][j]=a[i][j]+b[i][j]; cout< cout< 4、编写一个程序,用来分别求2个整数、3个整数、2个双精度数和3个双精度数的最大值。要求使用重载函数来完成。 #include cout<<\个整数的最大值 \else cout<<\个整数的最大值\ 共29 页,第 8页 void max(int x,int y,int z) { int max; if (x>y) max=x; else max=y; if (z>max) cout<<\个整数的最大值\else cout<<\个整数的最大值\} void max(double x,double y) { if(x>y) cout<<\个双精度数的最大值\else cout<<\个双精度数的最大值\void max(double x,double y,double z) { int max; if (x>y) max=x; else max=y; if (z>max) cout<<\个双精度数的最大值\else cout<<\个双精度数的最大值\} int main() 共29 页,第 9页 { int a,b,c,d,e; float f,g,h,i,j; cout<<\请输入2个整数:\cin>>a>>b; max(a,b); cout< cout<<\请输入3个整数:\cin>>c>>d>>e; max(c,d,e); cout< cout<<\请输入2个双精度数的最大值:\cin>>f>>g; max(f,g); cout< cout<<\请输入3个双精度数的最大值:\cin>>h>>i>>j; max(h,i,j); cout< 共29 页,第 10页