填空题以下函数用于求出一个2×4矩阵中的最大元素值。
max_value(arr)
int arr[][4];
{
int i,j,max;
max=arr[O][0];
for(i=0;i<2;i++)
for(j=0;{{U}} 【18】 {{/U}};j++)
if({{U}} 【19】 {{/U}}>max)max={{U}} 【20】 {{/U}};
return(max);
}
填空题以下程序的运行结果是______。 main() int a=1,b=2,c; if(a>b)c=1; else if(a==b)c=0; else c=-1; printf("%d/n",c);
填空题设有定义: structint a;float b;charc; abc;*p_abc=&abc;则对结构体成员a的引用方法可以是abc.a和p_abc 【20】 a。
填空题下列程序的输出结果是______。 #include <stdio.h> main() int x=10,y=10,i; for(i=0;x>8;y=++i printf("%d %d",x--,y);
填空题以下程序中函数fun()的功能是构成一个如图所示的带头结点的单向链表,在结点的数据域中放入了具有两个字符的字符串。函数disp的功能是显示输出该单向链表中所有结点中的字符串。请填空完成函数disp。#include<atdio.h>typedefstructnode/*链表结点结构*/charsub[3];structnode*next;NodeNode~un(chars)/*建立链表*/......voiddisp(Node*h)Node*Psp=h->next;while({{U}}{{/U}})printf("%s//n",p->suh);p={{U}}{{/U}};main()Node*hd;hd=fun();disp(hd);prinff("//n");
填空题下列程序的运行结果是______。 #include<stdio.h> long func(int x) long p; if(x==O‖x==1) return(1); p=x*func(x-1); return(p); main() printf("%d/n",func(4));
填空题在深度为S的满二叉树中,叶子结点的个数为______。
填空题有以下程序
#include
main()
{ int a=1,b=2,c=3,d=0;
if(a==1)
if(b!=2)
if(c==3) d=1;
else d=2;
else if(c!=3) d=3;
else d=4;
else d=5;
printf(“%d/n”,d);
}
程序运行后的输出结果是 【 】 。
填空题有以下程序段,且变量已正确定义和赋值
for(s=1.0,k=1;k<=n;k++)s=s+1.0/(k*(k+1));
printf("s=%f/n/n",s);
请填空,使下面程序段的功能与之完全相同
s=1.0;k=1;
while({{U}} 【8】 {{/U}}){s=s+1.0/(k*(k+1));{{U}} 【9】 {{/U}};}
printf("s=%f/n/n",s);
填空题以下程序的运行结果是{{U}} {{/U}}。 #include <stdio.h> #include <string.h> typcdef struct student char name[10]; long sno; float score; STU; main() STU a="Zhangsan",2001,95,b="Shangxian",2002,90, c="Anhua",2003,95,d,*p= d=a; if(strcmp(a.name,b.name)>0) d=b; if(strcmp(c. name, d. name)>0)d=c; printf("%1d%s//n",d.sno,p->name);
填空题以下程序的输出结果是{{U}} 【9】 {{/U}}。
double sub(double x,double y,double z)
{ y-=1.0;
z=z+x;
return z;
}
main()
{ double a=2.5,b=9.0;
printf("function running result is:%6.1f/n",sub(b-a,a,A) );
}
填空题以下程序运行后的输出结果是{{U}} {{U}} {{/U}} {{/U}}。
#include <stdio.h>
main()
{ int a=1,b=3,c=5;
if (c=a+b) printf("yes/n");
else printf("no/n");
}
填空题下列程序的输出结果是______。 10ng fun5(int n) long s; if((n==1) ‖(n==2)) s=2; else s=n+fun5(n-1) ; return(s); main() long x; x=fun5(4); printf("%1d/n",x);
填空题请补充main函数,该函数的功能是:打印出满足个位的数字、十位上的数字和百位上的数字都相等的所有二位数。
本题的结果为:111 222 333 444 555 666 777 888 999。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
main ()
{
int g, s, b;
clrscr {);
for(g=1; g<10; g++)
for (s=1; s<10; s++)
for(b=l; b<10; b++)
{
if({{U}} 【1】 {{/U}})
printf("%5d",{{U}} 【2】 {{/U}});
}
}
填空题有以下程序: main() int t=1, i=5; for(; i>=0; i--)t*=i; printf("% d/n", t); 执行后的输出结果是 【5】 。
填空题下列程序的输出结果是 【11】 。 int t(int x,int y,int cp,int dp) cp=x*x+y*y; dp=x*x-y*y; main() int a=4,b=3,c=5,d=6; t(a,b,c,d) ; printf("%d/n",c,d) ;
填空题给定程序中,函数fun()的功能是求ss所指字符数组中长度最短的字符串所在的行下标,作为函数值返回,并把其串长放在形参n所指变量中。ss所指字符数组中共有M个字符串,且串长<N。 请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。 注意:源程序存放在考生文件夹下的BLANK1.C中。不得增行或删行,也不得更改程序的结构。 #include<stdio.h> #include<string.h> #define M 5 #define N 20 int fun(char(*ss)[N],int *n) int i,k=0,len=N; /**********found**********/ for(i=0;i< (1) ;i++) len=strlen(ss[i]); if(i==0)*n=len; /**********found**********/ if(len (2) *n) *n=len; k=i; /**********found**********/ return (3) ; main() char ss[M][N]="shanghai", "guangzhou","beijing","tianjing","chongqing"; int n,k,i; printf("/nThe original strings are:/n"); for(i=0;i<M;i++)puts(ss[i]); k=fun(ss, printf("/nThe length of shortest string is:%d/n",n); printf("/nThe shortest string is:%s/n",ss[k]);
填空题在scanf()函数调用语句中,可以在格式字符和%号之间加上一个星号,它的作用是跳过对应的输入数据;当输入以下数据时,100 200 300 400 500<回车>,下面语句的执行结果为______。 main() int a,b,C; scanf("%d%*d%d%d",&a,&b,&c); printf("%d%d%d",a,b,c);
填空题下列给定程序中,函数fun的功能是:计算n的5次方的值(规定n的值大于2且小于8),通过形参指针传回主函数,并计算该值的个位、十位、百位上数字之和作为函数值返回。例如,7的5次方是16807,其后3位数的和值是15。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
#include<math.h>
int fun(int n,int,*value)
{
int d,s,i;
/**********found**********/
d=0;
/**********found**********/
s=1;
for(i=1;i<=5;i++)
d=d*n;
*value=d;
for(i=1;i<=3;i++)
{
s=s+d%10;
/**********found**********/
s=s/10;
}
return s;
}
main()
{
int n,sum,v;
do
{
printf("/nEnter n(2<n<8):");
scanf("%d",
}while(n<=2||n>=8);
sum=fun(n,
printf("/n/nThe result:/n value=%d sum=%d/n/n",v,sum);
}
填空题以下程序中函数fun的功能是:统计person所指结构体数组中所有性别(sex)为M的记录的个数,存入变量n中,并作为函数值返回。请填空: #include<stdio.h> #define N 3 typedef struct int mum;char nam[10];char sex;SS; int fun(SS person[]) int i,n=0: for(i=0;i<N;i++) if(______=='M')n++; return n; main() SS W[N]=1,"AA",'F'),(2,"BB",'M'),3,"CC",'M'));int n; n=fun(W);printf("n=%d/n",n);
