填空题语句: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);
}
填空题以下函数sstrcat的功能是实现字符串的连接,即将t所指字符串复制到s所指字符串的尾部。例如:,所指字符串为abed,t所指字符串为efgh,调用函数sstrcat后s所指字符串为 abcdefgh。请填空。 #inehde <stdio.h> #include <string.h> void sstuat(char * 9,char *t) int n; n = strlen (s); while(*(s+n) ={{U}} {{/U}})s++; t++;
填空题程序如下: main() int i=4; printf("%d",-++i); 该程序执行后的输出结果以及i的值分别是______ 、_______。
填空题用以下程序计算1到100的整数的累加和。请填空。
main( )
{int i,sum={{U}} 【13】 {{/U}};
i=1;
for({{U}} 【14】 {{/U}})
{sum + =j
i + +;
}
printf("sum=%d/n",{{U}} 【15】 {{/U}});
}
填空题下列程序的运行结果是{{U}} {{U}} {{/U}} {{/U}}。
#include<stdio.h>
main
{ int k=4,m=3,p;
p=func(k,m);
printf("%d",p);
p=func(k,m);
printf("%d/n",p);}
func(a,b)
int a,b;
{ static int m=0,i=2;
i+=m+1;
m=i+a+b;
return(m);}
填空题下列程序的运行结果是______。
#include<stdio.h>
main()
{ int a, b,c,n;
a=2;b=0;c=1;n=1;
while(n<=3)
{c=c*a;b=b+ c;++n;}
printf("b=%d", B) ;
}
填空题下列程序的运行结果是______。
#define POW(r)(r)*(r)
main()
{ int x=3,y=2,t;
t=POW(x+y);
printf("%d/n",t);
}
填空题以下程序运行后的输出结果是{{U}} 【8】 {{/U}} 。
main( )
{ int a=1,b=3,c=5;
if (c=a+b) printf("yes/n");
else printf("no/n");
}
填空题某二又树中度为2的结点有18个,则该二又树中有______个叶子结点。
填空题44. 在E-R图中,图形包括矩形框、菱形框、椭圆框。其中表示实体联系的是{{U}} {{/U}}框。
填空题函数fun的功能是计算xn。 double fun(double x,int n) int i; double y=1; for(i=1;i<=n;i++) y=y*x; return y; 主函数中已经正确定义变量m,a,b并赋值,要调用函数fun计算:m=a4+b4-(a+b)3。实现这一计算的函数调用语句为 【12】 。
填空题下面程序把从终端读入的文本(用@作为文本结束标志)输出到一个名为bi.dat的新文件中,请填空。 #include "stdio.h" FILE *fp; main() char ch; if((fp=fopen( 【16】 ))==NULL)exit(0); while((ch=getchar())!='@')fputc(ch,fp); fclose(fp);
填空题下列给定程序中,函数fun()的功能是:对N名学生的学习成绩,按从高到低的顺序找出前m(m≤10)名学生来,并将这些学生数据存放在一个动态分配的连续存储区中,此存储区的首地址作为函数值返回。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #include<malloc.h> #include<string.h> # include<conio.h> #define N 10 typedef struct ss char num[10]; int order; STU; STU *fun(STU a[], iht m) STU b[N], *tt; int i,j,k; 【1】 ; for(i=0; i<N; i++) b[i]=a[i]; for (k=0;k<m;k++) for (i=j=0;i<N;i++) if ( 【2】 ) j=i; tt [k]=b[j]; b[j].order=0; return 【3】 ; outresult (STU a[],FILE *pr) int i; for(i=0;i<N; i++) fprintf(pf,"No=%s Mark=%d/n", a[i].num,a[i].order); fprintf(pf,"/n/n"); main() STU [N]="A01",80,"A02",79, "A03",66,"A04",82,"A05",87, "A06",93,"A07",78,"A08",60, "A09",85,"A10",73; STU *p_order; int i,m; clrscr(); printf("*** The Origial data ***/n"); outresult(a, stdout); printf("/nGive the numeber of the students who have better score:"); scanf("%d", while (m>10) printf("/nGive the number of the studets who have better score:"); scanf("%d", p_order=fun(a,m); printf("*** THE RESULT ***/n"); printf("*** The top students ***/n"); for(i=0; i<m; i++) printf (" %s %d/n", p_order[i].num,p_order[i].order); free(p_order);
填空题以下fun函数的功能是:累加数组元素中的值,n为数组中元素的个数,累加的和值放入x所指的存储单元中。请填空。 fun(int b[ ],int n,int * x) int k,r=0; for(k=0,k<n;k + +)r= 【7】 ; 【8】 =r;
