发布时间 : 星期六 文章二级C语言2010年秋季考试(真题汇总)- 副本更新完毕开始阅读a002116c561252d380eb6ef4
计算机等级考试习题集
temp=arr[0];
for(i=0; i arr[i]=/**/ /**/ arr[n-1]=temp; } void main() { int a[10],i; for(i=0;i<10;i++) scanf(\ chg(a,10); for(i=0;i<10;i++) printf(\ getch(); } 1.将程序Ccon271.C填写完整,使程序输出如下图形: ---------- Ccon271.C--------------------------------------------------------------------------------- #include while(i<4) { j=0; while(/**/ /**/) { printf(\ j++; } printf(\ -13- 计算机等级考试习题集 i++; } for(i=3; /**/ /**/; i--) { j=1; while(j<=i) { printf(\ j++; } printf(\ } getch(); } 2.将程序Ccon272.C填写完整,用递归算法求13+23+33+...+n3的值。 ---------- Ccon272.C--------------------------------------------------------------------------------- #include long int k; if(/**/ /**/ ) k=1; else k=/**/ /**/ return (k); } void main() { int i; printf(\ scanf(\ if(i<0) printf(\ else printf(\ getch(); -14- 计算机等级考试习题集 } 1.将程序Ccon281.C填写完整,该程序的功能是:用插入排序法对输入的10个整数按从大到小排序,输出排序结果。例如: 输入:2 9 3 4 8 4 1 6 5 7 输出:9 8 7 6 5 4 4 3 2 1 2.将程序Ccon282.C填写完整,使其中的函数chg能够求3*3矩阵的转置矩阵。 例如:矩阵 1 2 3 4 5 6 7 8 9 转置后变成: 1 4 7 2 5 8 3 6 9 ---------- Ccon281.C--------------------------------------------------------------------------------- #include int i,j,k,x; /**/ /**/ printf(\ scanf(\ a[0]=x; for(k=1; k<=9; k++) { scanf(\ for(i=0; i for(j=k; /**/ /**/; j--) a[j]=a[j-1]; } a[i]=x; } for(i=0;i<10;i++) printf(\ \ -15- 计算机等级考试习题集 getch(); } ---------- Ccon282.C--------------------------------------------------------------------------------- #include int chg(/**/ /**/) { int i,j,temp; for(/**/ /**/) for(j=i+1;j<3;j++) { temp=array[i][j]; array[i][j]=array[j][i]; /**/ /**/ } } void main() { int i,j; int array[3][3]; printf(\ for(i=0;i<3;i++) for(j=0; j<3; j++) scanf(\ chg(array); printf(\ for(i=0;i<3;i++) { for(j=0; j<3; j++) printf(\ printf(\ } getch(); } -16-