填空题下面程序的输出结果是______。 #include<stdio.h> main() static char a[]="china"; char*ptr=a; while(*ptr) printf("%c",*ptr-32); ptr++;
填空题以下程序运行后的输出结果是______。 main () int x=10,y=20, t=0 if(x==y) t=x;x=y;y=t; printf("%d,%d /n",x,y);
填空题在一个容量为15的循环队列中,若头指针front=6,尾指针Year=9,则该循环队列中共有 【1】 个元素。
填空题设i,j,k均是int型变量,则执行以下for循环后,k的值为 【9】 。 for(i=0,j=10;i<=j;i++,j--) k=i+j;
填空题以下程序中给指针p分配三个double型动态内存单元,请填空。
# include <stdlib.h>
main ( )
{ double *p;
p=(double *) malloc( {{U}} 【18】 {{/U}} );
p[0]=1.5;p[1]=2.5;p[2]=3.5;
printf(“%f%f%f/n”,p[0],p[1],p[2]);
}
填空题若有如下程序: main() int x=4,y=3,x=2,t; t=x<y<z; printf("%d/n",t); 则程序运行后的输出结果是 【6】 。
填空题以下程序的输出结果为______。 #define JFT(x) x*x main( ) int a,k=3; a=++JFT(k+1); printf("%d",a);
填空题以下函数sstrcat()的功能是实现字符串的连接,即将t所指字符串复制到s所指字符串的尾部。例如:s所指字符串为abed,t所指字符串为efgh,函数调用后s所指字符串为abodefgh。请填空。 #include <string.h> void sstrcat(char *s,char *t) int n; n=strlen(s); while(*(s+n)= 【13】 )s++;t++;
填空题给定程序中已建立一个带有头结点的单向链表,在main()函数中将多次调用fun()函数,依次输出链表尾部结点中的数据,并释放该结点,使链表缩短。 请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。 #include<stdio.h> #include<stdlib.h> #define N 8 typedef struct list int data; struct list *next; SLIST; void fun(SLIST *p) SLIST *t,*s; t=p->next;s=p; while(t->next!=NULL) s=t; /**********found**********/ t=t-> (1) ; /**********found**********/ printf("%d", (2) ); s->next=NULL; /**********found**********/ free( (3) ); SLIST *creatlist(int *a) SLIST*h,*p,*q;int i; h=p=(SLIST*)malloc(sizeof(SLIST)); for(i=0;i<N;i++) q=(SLIST*)malloc(sizeof(SLIST)); q->data=a[i];p->next=q;p=q; p->next=0; return h; void outlist(SLIST *h) SLIST *p; p=h->next; if(p==NULL)printf("/nThe list is NULL!/a"); else printf("/nHead"); do printf("->%d",p->data);p=p->next;while(p!=NULL); printf("->End/n"); main() SLIST *head; int a[N]=11,12,15,18,19,22,25,29; head=creatlist(a); printf("/nOutput from head:/n");outlist(head); printf("/nOutput from tail:/n"); while(head->next!=NULL) fun(head); printf("/11/n"); printf("/nOutput from head again:/n");outlist(head);
填空题分析下列程序: main() int x=1,y=0,a=0,b=0; switch(a) case 1:switch(b) case 0:x++; case 1:y++;break; case 2:x++;y++;break; printf("x=%d,y=%d/n",x,y); 运行程序的输出结果是______。
填空题请补充函数fun(),该函数的功能是:把字符串str中的字符按字符的ASCⅡ码降序排列,处理后的字符串仍然保存在原串中,字符串及其长度作为函数参数传入。
例如,如果输入“cdefgh”,则输出为“hgfedc”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
#define N 80
void fun (char s [], int n)
{
int i, j;
char ch;
for (i=0; i<n; i++)
for(j={{U}} 【1】 {{/U}};j<n;j++)
if (s[i]<s [j])
{
ch=s [j];
{{U}} 【2】 {{/U}};
s [i] =ch;
}
main ( )
{
int i=0, strlen=0;
char str [N];
clrscr ();
printf ("/nInput a string: /n");
gets (str);
while (str [i] !=' /0')
{
strlen++;
i++;
}
fun (str, strlen);
printf ("/n***display string ***/n");
puts (str);
}
填空题以下程序运行后的输出结果是______。 #include<stdio.h> main() int a=1, b=2, e=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);
填空题以下程序运行后输入:3,abcde,则输出结果是【 】
#include <string.h>
move(char *str, int n)
{ char temp; int i;
temp=str[n-1];
for(i=n-1;i>0;i--) str[i]=str[i-1];
str[0]=temp;
}
main( )
{ char s[50]; int n, i, z;
scanf("%d,%s",
z=strlen(s);
for(i=1; i<=n; i++= move(s, z);
printf("%s/n",s);
=
填空题语句:x++;、++x;、x=x+1;、x=1+x;,执行后都使变量x中的值增1,请写出一条同一功能的赋值语句(不得与列举的相同){{U}} 【7】 {{/U}}。
填空题以下程序运行后输入“abcdef”,则输出结果是______。 #include<stdio.h> #include<string.h> void fun(char *str) char temp; int n, i; n=strlen(str); temp=str[n-1]; for(i=n-1; i>0; i--) str[i]=str[i-1]; str[0]=temp; main() char s[50]; scanf("%s", s); fun(s); printf("%s/n", s);
填空题下列程序段的输出结果是 ______。int n='c':switch(n++) default:printf("error");break; case'a':printf("good");break; case'c':printf("moming"); case'd':printf("class");
填空题有下列程序:
#include<stdio.h>
main()
{ char a[20]="How are you?",b[20];
scanf("%s",B) ;printf("%s%s/n",a,B) ;
}
程序运行时从键盘输入:How are you?<回车>
则输出结果为______。
填空题以下程序运行结果是 【15】 。 #include<stdio.h> main() int fun();fun(); fun() static int a[3]=0,1,2; int i; for(i=0;i<3;i++)a[i]+=a[i]; for(i=0;i<3;i++)printf("%d,",a[i]); printf("/n");
填空题以下程序运行后的输出结果是______。 #include <string.h> void fun(char *s,int p,int k) int i; for(i=p;i<k-1;i++) s[i]=s[i+2]; main() char s[]="abcdefg"; fun(s,3,strlerl(s)); puts(s);
填空题下面程序的功能是将字符串s中所有的字符c删除,补足所缺语句。
#include<stdio.h>
main()
{ char s[80];
int i,j;
gets(s);
for(i=j=0;s[i]!='/0';i++)
if(s[i]!='c'){{U}} 【10】 {{/U}};
s[j]='/0';
puts(s);
}
