填空题下面程序的输出结果是______。 # include <stdio.h> main( ) staic char b[]="Goodbye"; char * chp = &b [7]; while(- - chp>=&b[0])putchar (* chp); printf("/n");
填空题以下程序中函数huiwen的功能是检查一个字符串是否是回文,当字符串是回文时,函数返回字符串:yes!,否则函数返回字符串:no!,并在主函数中输出。所谓回文即正向与反向的拼写都一样,例如:adgda,请填空。
#include<string.h>
char*huiwen(char*str)
{ char*p1,*p2;int i,t=0;
p1=str;p2=______;
for(i=0;i<=strlen(str)/2;i++)
if(*p1++!=*p2--){t=1;break;}
if(t==0)return("yes!");
else return("no!");
}
main()
{ char str[50];
printf("Input:");scanf("%s",str);
printf("%s/n",huiwen(str));
}
填空题以下程序段的输出结果是 【6】 。 int i=9; printf("%o/n",i);
填空题由N个有序整数组成的数列已放在一维数组中,下列给定程序函数fun的功能是:利用折半查找法查找整数m在数组中的位置。若找到,返回其下标值;否则,返回-1。 折半查找的基本算法是:每次查找前先确定数组中待查的范围low和high(low<high),然后用m与中间位置(mid)上元素的值进行比较。如果m的值大于中间位置元素的值,则下一次的查找范围落在中间位置之后的元素中;反之,下一次的查找范围落在中间位置之前的元素中,直到low>high,查找结束。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构! 试题程序: #include<stdio.h> #define N 10 /**********found**********/ void fun(int a[],int m) int low=0,high=N-1,mid; while(low<=high) mid=(low+high)/2; if(m<a[mid]) high=mid-1; /********found**********/ else if(m>a[mid]) low=mid+1; else return(mid); return(-1); void main() int i,a[N]=(-3,4,7,9,13,45,67,89,100,180), k,m; printf("a数组中的数据如下:"); for(i=0;i<N;i++) printf("%d",a[i]); printf("Enter m:"); scanf("%d",&m); k=fun(a,m); if(k>=0) printf("m=%d,index=%d/n",m,k); else printf("Not be found /n");
填空题以下程序的功能是:输出a、b、c三个变量中的最小值。
#include <stdio.h>
main( )
{ int a,b,c,t 1,t2;
scanf("%d%d%d",
t1=a<b ?{{U}} 【7】 {{/U}};
t2=c<t1?{{U}} 【8】 {{/U}};
printf("%d/n", t2 );
}
填空题以下程序中,for循环体执行的次数是 【11】 。 # define N 2 # define M N+1 # define K M+1*M/2 main() int i; for(i=1; i<K; i++) ... ...
填空题有以下语句段: int n1=10,n2=20; printf("______",n1,n2); 要求按以下格式输出n1和n2的值: n1=10 n2=20每个输出行从第一列开始,请填空。
填空题有以下程序: #include <stdio.h> main() int n=0,m=1,x=2; if(! n)x-=1; if(m) x-=2; if(x) x-=3; printf("%d/n",x); 执行后的输出结果是 【10】 。
填空题下面程序和运行运行结果是【 】。
typedef union student
{ char name [10];
long sno;
char sex;
float score [4];
} STU;
main ( )
{ STU a[5];
prinff( "% d/n", sizeof(a) );
}
填空题下面程序的输出结果是{{U}} 【15】 {{/U}}。
#define MAX 3
int a[MAX];
main()
{fun1();{un2(A) ;printf("/n");}
funl()
{ int k,t=0;
for(k=0;k<MAX;k++,t++)a[k]=t+t;
}
fun2(int b[])
{ int k;
for(k=0;k<MAX;k++)printf("%d",*(b+k));
}
填空题在线性结构中,队列的操作顺序是先进先出,而栈的操作顺序是 【2】 。
填空题下面程序由两个源程序文件:t4.h和t4.c组成,程序编译运行的结果是:{{U}} [18] {{/U}}。
t4.h的源程序为:
#define N 10
#define t2 (x) (x*N)
t4.c 的源程序为:
#include <stdio.h>
#define M 8
#define f(x) ((x)*M)
#include "t4.h"
main()
{int i,j;
i=f(1+1); j=f2(1+1);
printf("%d%d/n",i,j);
}
填空题52. 下列程序的输出结果是______。 #include<stdio.h> main() int x=3,y=2,z=1; if(x<y) if(y<0)z+0; else Z+=1; primf(“%d//n",z);
填空题以下程序运行后的输出结果是 【7】 。 main() char m; m='B'+32; printf("%c/n",m);
填空题以下程序的输出结果是【 】。
#include
main( )
{char a[]={′\1′,′\2′,′\3′,′\4′,′\O′};
printf("%d%d\n",sizeof(a),strlen(a));
}
填空题给定程序MODI1.C中函数fun的功能是:求出s所指字符串中最后一次出现的t所指字符串的地址,通过函数值返回,在主函数中输出从此地址开始的字符串。若未找到,则函数的返回值为NULL。例如,字符串s中的内容为“abcdabfabcdx”,若t中的内容为“ah”时,则输出结果为:abcdx;若t中的内容为“abd”,则程序输出未找到的信息:not be found!。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 文件MODI1.C内容如下: #include<stdio.h> #include<string.h> char *fun(char *s,char *t) char *p,*r,*a; /**********found**********/ a=NUll; while(*s) p=s;r=t; while(*r) /**********found**********/ if(r==P)r++;p++; else break; if(*r=='/0')a=s; s++: return a; void main( ) char s[100],t[100],*p; printf("/nPlease enter string s: "); scanf("%s",s); printf("/nPlease enter string t: "); scanf("%s",t); p=fun(s,t); if(P)printf("/nTbe result is: %s/n",p); else printf("/nNot found!/n");
填空题若有如下程序: main() int x=5,y,*t;t= y=++(*t); printf("%d,%d",x,y); 则程序执行后的x值为 【16】 ,y的值为 【17】 。
填空题当运行以下程序时,输入abcd,程序的输出结果是______。 insert(char str[]) int i; i=strlen(str); while(i>0) str[2*i]=str[i];str[2*i-1]='*';i--; printf("%s/n",str); main() char str[40]; scanf("%s/n",str);insert(str);
填空题如图所示二叉树的后序遍历的结果为______。
填空题已有定义如下: struct node int data; struct node *next; *p; 以下语句调用malloc函数,使指针p指向一个具有struct node类型的动态存储空间。请填空。 p=(struct node *)malloc({{U}} {{/U}});
