填空题下列程序的功能是:求出ss所指字符串中指定字符的个数,并返回此值。 例如,若输入字符串123412132,指定字符1,则输出3。请填空。 #include<stdio.h) #deftne M 81 int fun(char * ss,char c) int i=0; for(;{{U}} {{/U}};ss++) if(*ss==c) i++; return i; main() char a[M],ch; printf("//nPlease enter a string:");gets(a); printf("//nPlease enterachar:");ch=getchar(); printf("//nThe number of the char is:%d//n",fun(a,ch));
填空题执行以下程序后,输出'#'号的个数是 {{U}}【10】{{/U}} 。#include main(){ int i,j;for(i=1; ifor(j=2; j}
填空题以下函数用来求出数组的最大元素在数组中的下标并存放在k所指的存储单元中。请填空。
#include<conio.h>
#include<stdio.h>
int fun(int*s,int t,int*k)
{ int i;
*k=0;
{{U}} 【10】 {{/U}}
if(s[*k]<s[i])*k=i;
return{{U}} 【11】 {{/U}};}
main()
{ int a[10]={876,675,896,101,301,401,980,431,451,777},k;
clrscr();
fun(a,10,&k);
printf("%d,%d/n",k,a[k]);}
填空题已知字符'A'的ASCⅡ代码值是65,字符变量c1的值是'A',c2的值是'D'。执行语句printf(“%d,%d,c1,c2-2);后,输出结果是______。
填空题以下程序运行后的输出结果是 【7】 。 #define S(x)4*x*x+1 mah() int i=6,j=8; printf("%d/n",S(i+j));
填空题以下函数fun用于求两个整数a和b的最大公约数。 fun(a,B) int a,b; int i,j,m,n; if(a>B) m=a;a=b; 【18】 ; i=a;j=b; while((n= 【19】 )!=0) j=i;i= 【20】 ; return(i);
填空题写出下列程序的执行结果。 swap(p1,p2) int*p1,*p2; int p; p=*p1;*p1=*p2;*p2=p; main() int a,b,*p1,*p2; scanf("%d%d",&a,&b); p1=&a;p2=&b; if(a<b)swap(p1,p2); printf("/na=%d,b=%d/n",a,b); 若a=7,b=8,则程序的运行结果为______。
填空题诊断和改正程序中错误的工作通常称为{{U}} 【1】 {{/U}}。
填空题下列给定程序中,函数fun的功能是:将str所指字符串中的字母转换为按字母序列的后续字母(Z转换A,z转换a),其他字符不变。 请修改函数fun中的错误,得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include<stdio.h> #include<ctype.h> #include<conio.h> void fun(char*str) /*******found*********/ while(*str!='@') if(*str>='A'&&*str<='Z'||*str<='a'&&*str<='z') if(*str=='Z') *str='A'; else if(*str=='z') *str='a'; else *str+=1; /*******found*********/ (*str)++; main() char str[80]; printf("/n Enter a string with length<80.:/n/n"); gets(str);printf("/n The string:/n/n"); puts(str); fun(str); printf("/n/n The Cords:/n/n"); puts(str);
填空题以下程序运行后的输出结果是______。 #include<stdio.h> void fun(int *a) a[0]=a[1]; main() int a[10]=10, 9, 8, 7, 6, 5, 4, 3, 2, 1, i; for(i=2; i>=0; i--) fun( for(i=0; i<10; i++) printf("%d", a[i]); printf("/n");
填空题源程序文档化要求程序应加注释。注释一股分为序言性注释和 (4) 。
填空题下面程序的运行结果是______。
#include<stdio.h>
main()
{ union
{ int i[2];
long k;
char c[4];
}t,*s=
s->i[0]=0x12;
s->i[1]=0x34;
print f("%1x/n",s->k);
}
填空题以下程序运行后的输出结果是【 】。
main()
{int m=011,n=11;
printf("%d%d\n",++m,n++);
}
填空题计算机网络按通信距离来划分可以分为 【3】 。
填空题给定程序中,函数fun的功能是:将a所指3×5矩阵中第k列的元素左移到第0列,第k列以后的每列元素依次左移,原来左边的各列依次绕到右边。
例如,有下列矩阵:
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
若k为2,程序执行结果为:
3 4 5 1 2
3 4 5 1 2
3 4 5 1 2
请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。
不得增行或删行,也不得更改程序的结构!
给定源程序:
#include<stdio.h>
#define M 3
#define N 5
void fun(int (*a)[N], int k)
{ int i, j, p, temp;
/**********found**********/
for(p=1; p<=______; p++)
for(i=0; i<M; i++)
{ temp=a[i][0];
/**********found**********/
for(j=0; j<______; j++)
a[i][j]=a[i][j+1];
/**********found**********/
a[i][N-1]=______;
}
}
main()
{ int x[M][N]={ {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5}}, i, j;
printf("The array before moving:/n/n");
for(i=0; i<M; i++)
{ for(j=0; j<N; j++)printf("%3d", x[i][j]);
printf("/n");
}
fun(x, 2);
printf("The array after moving:/n/n");
for(i=0; i<M; i++)
{ for(j=0; j<N; j++)printf("%3d", x[i][j]);
printf("/n");
}
}
填空题若从键盘输入58,则以下程序的输出结果是{{U}} 【6】 {{/U}}。
main()
{ int a;
scanf(“%d”,&A) ;
if(a>50)printf(“%d”,A) ;
if(a>40)printf(“%d”,A) ;
if(a>30)printf(“%d”,A) ;
}
填空题下面程序的输出是{{U}} {{/U}}main() enum ememl=3,em2=1,em3; char*aa[]="AA',"BB","CC","DD" printf("%s%s%//n",aa[em1],aa[em2],aa[em3]);
填空题没有char,a,b;,若要通过a&d运算屏蔽掉a中的其他位,只保留第2位和第8位(右起为第1位),则b的二进制是{{U}} 【7】 {{/U}}。
填空题给定程序中,函数fun()的功能是:使数组中的元素的值增加10倍。 改正其中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构. 试题程序: #include<stdio.h> #include<conio.h> iht m[10]; void fun(void) int j; printf("In subfunc after calling/n"); for(j=0;j<l0;j++) /************found**********************/ printf("%3d",m[j]*l0); main() int i; printf("In main before calling/n"); for (i=0; i<10; i++) m[i]=i; printf ("%3d",m[i]); fun (); printf("/nIn main after calling/n"); for (i=0; i<10; i++) printf ("%3d",m[i]); getch ();
填空题以下程序的运行结果为 【13】 。 main() int i,j,a[3][4]=1,2,3,4,5,6,7,8,9,10,11,12,b[4][3]; for(i=0;i<3;i++) for(j=0;j<4;j++) b[j][i]=a[i][j]; for(i=0;i<4;i++) for(j=0;j<3;j++) printf("%-3d",b[i][j]); printf("/n");