【程序填空】功能:求出二维数组中的最小元素值。 #include
/***********FILL***********/ min_value(int m,int n,_____) {
int i,j,min; min=array[0][0]; for(i=0;i /***********FILL***********/ if(min_____array[i][j]) min=array[i][j]; /***********FILL***********/ return(_____); } void main() { int a[3][4]={{1,3,5,7},{2,4,6,8},{15,17,34,12}}; /***********FILL***********/ printf(\} 【参考答案】int array[][4] int array[3][4] 【参考答案】> >= 【参考答案】min 【参考答案】min_value(3,4,a) 【程序填空】功能:输入两个整数x,y,求他们的阶乘和x!+y!。 #include /**********FILL************/ for(_____;i<=ss;i++) n=n*i; /**********FILL************/ _____ n;} main() {int x,y; scanf(\/**********FILL************/ printf(\} 【参考答案】i=1 【参考答案】return 【参考答案】fun(x)+fun(y) fun(y)+fun(x) 【程序填空】功能:产生并输出如下形式的方阵。 1 2 2 2 2 2 1 3 1 2 2 2 1 4 3 3 1 2 1 4 4 3 3 3 1 4 4 4 3 3 1 5 1 4 4 3 1 5 5 5 1 4 1 5 5 5 5 5 1 #include int a[7][7]; int i,j; for (i=0;i<7;i++) for (j=0;j<7;j++) { /**********FILL**********/ if (_____) a[i][j]=1; /**********FILL**********/ else if (i for (i=0;i<7;i++) { for (j=0;j<7;j++) printf(\ /**********FILL**********/ _____ } } 【参考答案】i==j||i+j==6 【参考答案】a[i][j]=2 【参考答案】i 【程序填空】功能:建立一个元素值全为0的二维数组 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 并按以下格式输出。 6 0 0 0 6 0 6 0 6 0 0 0 6 0 0 0 6 0 6 0 6 0 0 0 6 #include 1 /***********FILL***********/ int a[5][5]={_____},i,j; for(i=0;i<5;i++) { /***********FILL***********/ a[i][i]=_____; /***********FILL***********/ a[i][_____]=6; } for(i=0;i<5;i++) { /***********FILL***********/ for(j=0;j<5;j++)printf(\ printf(\ } } 【空1参考答案】 0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 【空2参考答案】6 【空3参考答案】4-i 【空4参考答案】a[i][j] 【程序填空】写一个函数,求一个字符串的长度,在main函数中输入字 符串,并输出其长度。 #include int length(char p[]); int len; char str[20]; printf(\ scanf(\ /***********FILL***********/ len=length(_____); printf(\} /***********FILL***********/ _____(char p[]) { int n; n=0; while(p[n]!='\\0') { /***********FILL***********/ _____; } return n; } 【空1参考答案】str 【空2参考答案】int length length 【空3参考答案】n++ ++n n=n+1 n+=1 n=1+n 【程序填空】从低位开始取出长整型变量s中奇数位上的数,依次构成一 个新数放在t中。 #include \void fun (long s, long *t) { long sl=10; s /= 10; /***********FILL***********/ *t = s _____ 10; while(s>0) { /***********FILL***********/ s = _____; /***********FILL***********/ *t = s*sl_____; /***********FILL***********/ sl = sl _____10; } } main() { long s, t; printf(\fun(s, &t); printf(\} 【空1参考答案】% 【空2参考答案】s/100 【空3参考答案】+ *t 【空4参考答案】* 【程序填空】功能:请编写函数fun,它的功能是:求出1到100之间能被 7或11整除,但不能同时被7和11整除的所有整数并将它们放在 a所指的数组中,通过n返回这些数的个数。 #include /**********FILL************/ _____; for(i=7;i<100;i++) 2 /**********FILL************/ if(((i%7)==0||(i)==0)_____(iw)!=0) a[n++]=i; return n;} main() {int x[1000],m,i; m=fun(x); /**********FILL************/ printf(\for(i=0;i 【空1】 错误 【参考答案】n=0 【参考答案】&& 【参考答案】m 【程序填空】题目:输入一个字符,判别它是否为小写字母,如果是,将它转 换成大写字母,如果不是,不转换,最后输出得到的字符, 请填空。 #include \main() { char ch; scanf(\ /***********FILL***********/ ch=(_____)?ch-32 :ch; printf(\ } 【参考答案】ch>='a'&&ch<='z' 【程序填空】功能:将s所指字符串的正序和反序进行连接,形成一个新串放在t 所指的数组中。 例如:当s串为\时,则t串的内容应为\。 #include void fun (char s[], char t[]) { int i, d; /***********FILL***********/ d = _____; /***********FILL***********/ for (i = 0; i for (i = 0; i } main() { char s[100], t[100]; printf(\enter string S:\scanf(\s); fun(s, t); printf(\} 【参考答案】strlen(s) 【参考答案】i++ ++i i=i+1 i+=1 【参考答案】d+i 【参考答案】2*d i+d d+i d+d 【程序填空】题目:本程序用scanf函数输入字符串\然后输出,完善程序。 #include \main() { /***********FILL***********/ _____s1[10]; /***********FILL***********/ scanf(\ printf(\} 【参考答案】char 【参考答案】s1 八 【程序填空】题目:用scanf函数,为字符数组s1输入字符串\。 #include \main() { /***********FILL***********/ _____ s1[10]; /***********FILL***********/ scanf(\} 【参考答案】char 【参考答案】s1 【程序填空】功能:是将两个字符串连接为一个字符串,不许使用库函数strcat。 #include join(char s1[80],char s2[40]) 3 { int i,j; /***********FILL***********/ _____; /***********FILL***********/ for (i=0; _____'\\0';i++) s1[i+j]=s2[i]; /***********FILL***********/ s1[i+j]= _____ ; } main ( ) { char str1[80],str2[40]; gets(str1);gets(str2); puts(str1);puts(str2); /***********FILL***********/ _____; puts(str1); } 【参考答案】j=strlen(s1) for(j=0;s1[j]!='\\0';j++); for(j=0;s1[j];j++); 【参考答案】s2[i]!= 【参考答案】'\\0' NULL 0 【参考答案】join(str1,str2) 【程序填空】功能:从键盘输入一个字符串,以!结束, 将小写字母全部转换成大写字母,其它字符不变。 #include /**********FILL************/ if(ss>='a'&&_____)n=1; return n;} main() {char ch; /**********FILL************/ while((ch=getchar())!=_____) { if(fun(ch)) ch=ch-32; /**********FILL************/ printf(\} 【参考答案】ss<='z' 【参考答案】'!' 【参考答案】ch 【程序填空】功能:任意输入10个数,然后再输入一个数,找出10个数中与这个数 相等的数的个数。 #include { /***********FILL***********/ int a[10],i,t,_____; for(i=0;i<10;i++) /***********FILL***********/ scanf(\ scanf(\ for(i=0;i<10;i++) if(a[i]==t) /***********FILL***********/ _____; printf(\} 【参考答案】p=0 【参考答案】&a[i] 【参考答案】p++ ++p p=p+1 p+=1 p=1+p 【程序填空】功能:以下程序的功能如(图1)。#include /**********FILL**********/ _____ double t,pi; t=1;pi=t;f=1;n=1.0; /**********FILL**********/ while(_____) { n=n+2; /**********FILL**********/ _____ t=f/n; pi=pi+t; } /**********FILL**********/ _____ printf(\} 【参考答案】float n double n 【参考答案】fabs(t)>=1e-6 fabs(t)>=0.000001 4
相关推荐: