填空题以下程序的功能是:将值为三位正整数的变量x中的数值按照个位、十位、百位的顺序拆分并输出。请填空。
#include
main()
{ int x=256;
printf("%d-%d-%d/n", 【 】 ,x/10%10,x/100);
}
填空题有下列程序 #include<stdio.h> main() char c1,c2; scanf("%c"&c1); while(c1<65||c1>90)scanf("%c",&c1); c2=c1+32: printf("%c,%c/n",c1,c2); 程序运行输入65回车后,能否输出结果、结束运行(请回答能或不能)______。
填空题下面定义的结构体类型包含3个成员,其中成员变量x用来存入整型数据,成员变量y用来存入实型数据,成员变量next是指向自身结构体的指针。请将定义补充完整。 struct stu int x; 【15】 【16】 next;
填空题以下程序从名为filea.dat的文本文件中逐个读入字符并显示在屏幕上。请填空。 #include main() FILE*fp;char ch; fp=fopen(______); ch=fgetc(fp); while(!feof(fp))pufchar(ch);ch=fgetc(fp); putchar(‘/n’);fcloseffp);
填空题给定程序中,函数fun的功能是:判断形参s所指字符串是否是“回文”(Palindrome),若是,函数返回值为1;不是,函数返回值为0。“回文”是正读和反读都一样的字符串(不区分大小写字母)。
例如,LEVEL和Level是“回文”,而LEVLEV不是“回文”。
请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。
不得增行或删行,也不得更改程序的结构!
给定源程序:
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int fun(char *s)
{ char *lp, *rp;
/**********found**********/
lp=______;
rp=s+strlen(s)-1;
while((toupper(*lp)==toupper(*rp)) rp______;}
/**********found**********/
if(lp<rp)______;
else relurn 1;
}
main()
{ char s[81];
printf("Enter a string:"); scanf("%s", s);
if(fun(s)) printf("/n"%s" is a Palindrome./n/n", s);
else printf("/n"%s"isn"t a Palindrome./n/n". s);
}
填空题若有以下定义和输入语句,要求给c1、c2分别输入字符A和8,给a1、a2分别输入7.29和101.298,从键盘正确输入数据的形式是______。
char c1, c2; float a1, a2;
scanf("%f%f", scanf("%c%c",
填空题下面程序段的输出结果是 【8】 。 int x=5; doprintf("%d ",x-=4); while (!(--x));
填空题以下程序的输出结果是{{U}} {{/U}}。 #include <stdio.h> #deftne JFT(x)x*x main() int a,k=3; a=++JFT(k+1); printf("%d",a);
填空题下列程序的输出结果是______。 main() int i=0,a=0; while(1<20) for(;;) if((i%10)==0)break; else i--; i+=11; a+=i; printf("%d/n" ,a);
填空题下列程序运行后的输出结果是______。
#include<stdio.h>
main()
{ int a=1,b=7;
do{
b=b/2;a+=b;
}while(b>1;
printf("%d/n",A) ;}
填空题若输入tear、test、arj,则下列程序的运行结果为{{U}} 【9】 {{/U}}。
main()
{ char*strl[20],*str2[20],*str3[20];
char swap();
scanf("%s",str1);
scanf("%s",str2);
scanf("%s",str3);
if (strcmp(str1,str2)>0)swap(str1,str2);
if (strcmp(str1,str3)>0)swap(str1,str3);
if (strcmp(str2,str3)>0)swap(str2,str3);
printf("%s %s %s/n",str1,str2,str3);
}
char swap(p1,p2)
char*p1,*p2;
{ char*p[20];
strcpy(p,p1);strcpy(p1,p2);strcpy(p2,p);
}
填空题在结构化分析使用的数据流图(DFD)中,利用______对其中的图形元素进行确切解释。
填空题以下程序的功能是:删去一维数组中所有相同的数,使之只剩一个。数组中的数已按由小到大的顺序排列,函数返回删除后数组中数据的个数。 例如,若一维数组中的数据是: 2 2 2 3 4 4 5 6 6 6 6 7 7 8 9 9 10 10 10 删除后,数组中的内容应该是: 2 3 4 5 6 7 8 9 10 请填空。 #include<stdio.h> #define N 80 int fun(int a[],int n) int i,j=1; for(i=1;i<n;i++) if(a[j-1] 【8】 a[i]) a[j++]=a[i]; 【9】 ; main() int a[N]=2,2,2,3,4,4,5,6,6,6,6,7,7,8,9,9,10,10,10,i,n=19; printf("The original data :/n"); for(i=0;i<n;i++)printf("%3d",a[i]); n=fun(a,n); printf("/nThe data after deleted :/n"); for(i=0;i<n;i++)printf("%3d",a[i]);printf("/n/n");
填空题以下程序运行后的输出结果是______。 #include <stdio.h> main() int k=1,s=0; do if((k%2)!=0) continue; s+=k;k++; while(k>10); printf("s=%d/n",s);
填空题以下程序运行后的输出结果是 【14】 。 #include<stringh> 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,strlen(s));puts(s);
填空题关系可以有3种类型,即基本关系(又称基本表或基表)、查询表和{{U}} 【4】 {{/U}}。
填空题有以下程序 #include <stdio.h> main( ) { char ch1,ch2; int n1,n2; ch1=getchar( ); ch2=getchar( ); n1=ch1-‘0’; n2=n1*10+(ch2-‘0’); printf(“%d/n”,n2);} 程序运行时输入:12,执行后输出结果是{{U}} 【10】 {{/U}}。
填空题下列程序的运行结果是______。 #include<stdio.h> main() int a=10,b=3; printf("%d,",a%b); printf("%d,",(a-h,a+b)); printf("%d/n",a-b?a-b:a+b);
填空题以下程序的运行结果是______。
#include <stdio.h>
main()
{FILE *fp; int a[10]={1,2,3,0,0},i;
fp=fopen("d2.dat","wbt");
fwtite(a,sizeof(int),5,fp);
fwlite(a,sizeof(int),5,fp);
fclose(fp);
fp=fopen("d2.dat","rb");
fread(a,sizeof(int),10,fp);
fclose(fp);
for(i=0;i<10;i++)printf("%d",a[i]);
}
填空题以下程序运行后的输出结果是{{U}} 【15】 {{/U}}。
main()
{ int i,j,a[][3]={1,2,3,4,5,6,7,8,9};
for(i=0;i<3;i++)
for(j=i+1;j<3;j++)a[j][i]=0;
for(i=0;i<3;i++)
{ for(j=0;j<3;j++)printf("%d",a[i][j]);
printf("/n");
}
}
