填空题某二义树中度为2的结点有18个,则该二叉树中有______ 个叶子结点。
填空题下面fun函数的功能是将形参x的值转换成二进制数,所得二进制数的每一位数放在数组中返回,二进制数的最低位放在下标为0的元素中,其他依此类推。请填空。 Fun(int x,int b[]) int k=0,r; do r=x%2; ______=r; x/=2; while(x);
填空题在进行关系数据库的逻辑设计时,E-R图中的属性常被转换为关系中的属性,联系通常被转换为U 【5】 /U。
填空题给定程序MODI1.C中函数fun的功能是将s所指字符串的正序和反序进行连接,形成一个新串放在t所指的数组中。
例如,当s所指字符串为:“ABCD”时,则t所指字符串中的内容应为“ABCDDCBA”。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
给定源程序如下。
#include<stdio.h>
#include<string.h>
/**************found**********/
void fun(char s,char t)
{
int i,d;
d=strlen(s);
for(i=0;i<d;i++)t[i]=s[i];
for(i=0;i<d;i++)t[d+i]=s[d-1-i];
/*************found**********/
t[2*d-1]="/0";
}
main()
{
char s[100],t[100];
printf("/nPlease enter string S:");
scanf("%s",s);
fun(s,t);
printf("/nThe result is:%s/n",t);
}
填空题下列给定程序中,函数fun的功能是:从s所指字符串中,找出t所指字符串的个数作为函数值返回。例如,当s所指字符串中的内容为“abcdabfab”,t所指字符串的内容为“ab”,则函数返回整数3。
请改正程序中的错误,使它能得出正确的结果。
注意
:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include <stdlib.h>
#include <conio.h>
#include <stdio.h>
#include <string.h>
int fun(char *s,char *t)
{
int n;char *p,*r;
n=0;
while(*s)
{
p=s;
r=t;
while(*r)
/********found********/
if(*r==*p){r++;p++}
else break;
/********found********/
if(r=="/0")
n++;
s++;
}
return n;
}
void main()
{
char s[100],t[100];int m;
system("CLS");
printf("/nPlease enter string s:");
scanf("%s",s);
printf("/nPlease enter substring t:");
scanf ("%s",t);
m=fun(s,t);
printf("/nThe result is:m=%d/n", m);
}
填空题下列程序段的输出结果是______。 int n='c'; switch(n++) default:printf("error");break; case 'a': printf("good");break; case 'c': printf("morning"); case 'd': printf("class");
填空题若已知a=10,b=20,则表达式! a<b的值为 【13】 。
填空题以下程序的功能是将字符串s中的数字字符放入d数组中,最后输出d中的字符串。例如,输入字符串:abcl23edf456gh,执行程序后输出:123456。请填空。
#include <stdioo.h>
#include <ctype.h>
main()
{ char s[80],d[80]; int i,j;
gets(s);
for(i=j=0;s[i]!='/0';i++)
if({{U}} 【20】 {{/U}}){d[j]=s[i];j++;}
d[j]='/0';
puts(d);
填空题下列程序的输出结果是______. #include <stdio.h> fun () static int a=O; a+=3; printf("%d",a); main () int cc; for (cc=1;cc<5;cc++) fun(); printf ("/n");
填空题若a是int型变量,则表达式(a=2*3,a*2),a+4的值为______。
填空题下列程序的功能是计算机一元二次方程的根。
#include{{U}} 【10】 {{/U}}
#include <stdio.h>
main ( )
{ float a, b, c, disc, x1, x2, realpart, imagpart;
scanf("%f%f%f",
printf("The equation");
if({{U}} 【11】 {{/U}}<=1e-6)
printf(" is not quadratic/n");
else
disc=b*b-4*a*c;
if (fabs (disc) <=1e-6)
printf("has two equal roots:%-8.4f/n",-b/(2*a));
else if({{U}} 【12】 {{/U}})
{ x1= (-b+sqrt (disc))/(2*a);
x2= (-b-sqrt (disc))/(2*a);
printf("has distinct real roots:%8.4f and %.4f/n",xl,x2);
}
else
{ realpart=-b/(2*a);
imagpart=sqrt (-disc)/(2*a);
printf("has complex roots:/n");
printf ("%8.4f+%. 4fi/n", realpart, imagpart);
printf ("%8.4f-%. 4fi/n", realpart, imagpart);
}
}
填空题以下程序的输出结果是 【14】 。 #include<stdio.h> fun() static int a=0; a+=2;printf("%d",a); main() int cc; for(cc=1;CC<4;CC++)fun(); printf("/n");
填空题在宏定义#define PI 3.14159中,用宏名PI代替一个______。
填空题下列程序的功能是计算数的阶乘。main() iht i,n; nlong np; scanf("%d",&n); np=______; for(i=2;i<=n;i++) ______; printf("n=%d n!=%ld/n",n,np);
填空题下面程序的功能是输出数组s中最大元素的下标,请填空。
#include <stdio.h>
main()
{ int k, p,s[]={1, -9,7,2, -10,3};
for(p =0,k =p; p<6; p++)
if(s[p]>s[k]) {{U}}【13】 {{/U}}
printf("%d/n", k);
}
填空题程序的运行结果为 【6】 。 main() char c1='a',c2='b',c3='c'; printf("a%cb%c/tc%c/n",c1,c2,c3);
填空题设int a=5,b=6,表达式(++a==b--)?++a:--b的值是______。
填空题有以下程序 #include<stdio.h> main() int x,y; scarf("%2d%1d",&x,&y);printf("%d//n",x+y); 程序运行时输入:1234567,程序的运行结果是{{U}} {{/U}}。
填空题以下程序的输出结果是【 】。
#include
main()
{char *sl,*s2,m;
sl=s2=(char*)malloc(sizeof(char)).
*sl=15; *s2=20; m=*sl+*s2;
printf("%d\n",m);
}
填空题E-mail地址由域名和用户名两部分组成,它们之间用@分隔,其中在@后面的部分是【 】。
