填空题深度为7的满二叉树中,叶子结点的个数为______。
填空题设有定义:int n,*k=&n;以下语句将利用指针变量k读写变量n中的内容,请将语句补充完整。 scanf(“%d”, 【6】 ); printf(“%d/n”, 【7】 );
填空题下面fun函数的功能是将形参x的值转换成二进制数,所得二进制数的每一位数放在数组中返回,二进制数的最低位放在下标为0的元素中,其他依此类推。请填空。 Fun(int x,int b[]) int k=0,r; do r=x%2; ______=r; x/=2; while(x);
填空题用高级语言编写的程序称为 【11】 程序,它可以通过解释程序翻译一句执行一句的方式执行,也可以通过编译程序一次翻译产生目标程序,然后执行。
填空题在进行关系数据库的逻辑设计时,E-R图中的属性常被转换为关系中的属性,联系通常被转换为U 【5】 /U。
填空题有以下程序: void f(int*x,iht * y) int t; t=*x;*x;=*y;*y=t; main() int a[8]=1,2,3,4,5,6,7,8,i,*p,*q; p=a;q= while(p) f(p,q);p++;q--; for(i=0;i<8;i++)printf("%d,",a[i]); 程序运行后的输出结果是 【11】 。
填空题str为一个字符序列,序列由字符0和1组成。请补充函数 fun(),该函数的功能是:查找该字符序列中0字符连续出现的最长长度(即0字符的个数),如果有几个0字符串长度相同,只记录最后一个0字符串的相关信息。通过m和k返回最长0字符串的长度和最后0字符的下标。例如,如果输入“01001000”,结果为:0字符串最长长度为3,起始和结尾下标依次为5、7。 注意:部分源程序给出如下. 请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #include<conio.h> #define N 80 void fun ( 【1】 ) int i, j=0; int bb[N]; char *p=str; *m=0; *k=0; for(i=0;i<N;i++) bb[i]=0; i=0; while(*(p+i)) if(*(p+i)='0') 【2】 i++; else j++; i++; if ( 【3】 ) *m=bb[j]; *k=i-1; main() char str[N]; int m,n,k; clrscr(); printf("***input the original string ***/n"); gets(str); printf("***The Original string ***/n"); puts(str); fun(str, printf("/nThe length of '0' is : %d/n",m); printf("*** The suffix of character ***/n"); printf(" %d,%d",k-m+1,k);
填空题以下函数的功能是求出能整除x且不是偶数的各整数,并按从小到大的顺序放在pp所指的数组中,这些除数的个数通过形参n返回。例如,若x中的值为30,则有4个数符合要求,它们是1,3,5,15。请按题意,完成填空。 试题程序: #include<conio.h> #include<stdio.h> void fun(int x,int pp[],int *n) int i,j=0; for(i=1;i<x;i+=2) if(x%i==0)pp[j++]=i; 【15】 ; main() int x,aa[1000],n,i; clrscr(); printf("/nPleas enter an integer number :/n");scanf("%d", for(i=0;i<n;i++) printf("%d",aa[i]); printf("/n");
填空题下列程序的输出结果是______. #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");
填空题某二义树中度为2的结点有18个,则该二叉树中有______ 个叶子结点。
填空题已定义charch=′$′;inti=1,j;,执行j!=ch&&++以后,i的值为【 】。
填空题下列程序段的输出结果是______。 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】 。
填空题给定程序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);
}
填空题以下程序的输出结果是 【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");
填空题下列给定程序中,函数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);
}
填空题下列程序的功能是计算机一元二次方程的根。
#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);
}
}
填空题以下程序的功能是将字符串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);
填空题若a是int型变量,则表达式(a=2*3,a*2),a+4的值为______。
填空题在宏定义#define PI 3.14159中,用宏名PI代替一个______。
