【参考答案】 break; 【参考答案】 i++ ++i i=i+1 i+=1
/*请补充函数fun,该函数的功能是:把一个整数转换成字符串,并倒序保存在字符数组str中。
例如,当n=13572468时,str=\。 注意:部分源程序给出如下。
请勿改动main函数和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。 试题程序:*/
#include
void fun(long int n) {
int i=0;
/**********FILL**********/ while( [1] ) {
/**********FILL**********/ str[i]= [2] ; n/=10; i++; }
/**********FILL**********/ [3] ; }
void main() {
long int n=13572468;
printf(\ printf(\ fun(n);
printf(\}
【参考答案】 n>0 0 !(n<=0) 【参考答案】 n>0 0 /*请补充函数fun(char*s),该函数的功能是:把字符串中的内容逆置。 例如,字符串中原有的字符串为abcde,则调用该函数后,串中的内容为edcba。 注意:部分源程序给出如下。 请勿改动main函数和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。 试题程序: */ #include void fun(char s[]) { int i,n=strlen(s)-1; char t; /**********FILL**********/ for(i=0;i t=s[i]; /**********FILL**********/ [2] ; /**********FILL**********/ [3] ; } } void main() { char a[N]; printf(\ gets(a); printf(\ puts(a); fun(a); printf(\ printf(\ puts(a); } 【参考答案】 for(i=0;i for(i=0;i /*请补充函数fun,该函数的功能是:把ASCII码为偶数的字符从字符串str中删除,结果仍然保存在字符串str中, 字符串str从键盘输入,其长度作为参数传入函数fun。例如,输入\输出\。注意:部分源程序给出如下。 请勿改动main函数和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。 试题程序:*/ #include /**********FILL**********/ [1] { int i, j; /**********FILL**********/ [2] ; for (i=0;i if(s[i]%2!=0) s[j++]=s[i]; } /**********FILL**********/ [3] ; } void main() { int i=0, strlen=0; char str[N]; printf(\ gets(str); while(str[i]!='\\0') { strlen++; i++; } fun(str, strlen); printf(\ puts (str); } 【参考答案】 void fun(char s[],int n) void fun(char *s,int n) 【参考答案】 j=0; 【参考答案】 s[j]=0; s[j]='\\0'; /*请补充main函数,该函数的功能是:计算每个学生成绩的平均分,并把结果保存在数组bb中。 例如,当score[N][M]={{83.5,82,86,65,67}, {80,91.5,84,99,95}, {90.5,95,86,95,97}}时,三个学生的平均分为76.7,89.9,92.7。 注意:部分源程序给出如下。 请勿改动main函数和其他函数中的任何内容,仅在main函数的横线上填入所编写的若干表达式或语句。 试题程序: */ #include int i,j; static float score[N][M]={{83.5,82,86,65,67}, {80,91.5,84,99,95}, {90.5,95,86,95,97}}; float bb[N]; for(i=0;i /**********FILL**********/ [1] ; for(i=0;i for(j=0;j for(i=0;i printf(\} 【参考答案】 bb[i]=0;
相关推荐: