Bygoewn历年全国计算机等级考试_二级C语言上机考试题库及答案
show(std);
printf("\nInput a number : "); scanf("%f",&a); /**********found**********/ modify(___3___,a);
printf("\nA result of modifying :\n"); show(std); } 修改
给定程序MODI。C中函数fun的功能是:求k!(k<13),所求阶乘的值作为函数值返回,例如若(k=10,则应输出:3628800 long fun ( int k) {
/************found************/ if k > 0
return (k*fun(k-1));
/************found************/ else if ( k=0 ) return 1L; } 设计
程序定义了N*N的二维数组。并在主函数中自动赋值,请编写函数fun,函数的功能是:使数组左下三角元素的值乘以n 例如:若n的值为3,a数组的值为
13、B: STU score[i] &std M: ( ) k= =0 P: int i, j; for(i = 0 ; i < N ; i++) for(j = 0 ; j <= i; j++) a[i][j] *= n ; 14.填空
给定程序中,函数fun的功能是:将形参所指结构体数组中的三个元素按num成员进行升序排列
/**********found**********/ void fun(PERSON ___1___) {
/**********found**********/ ___2___ temp;
if(std[0].num>std[1].num)
{ temp=std[0]; std[0]=std[1]; std[1]=temp; } if(std[0].num>std[2].num)
{ temp=std[0]; std[0]=std[2]; std[2]=temp; } if(std[1].num>std[2].num)
{ temp=std[1]; std[1]=std[2]; std[2]=temp; } }
main()
{ PERSON std[ ]={ 5,"Zhanghu",2,"WangLi",6,"LinMin" }; int i;
/**********found**********/