填空题有以下程序(说明:字符0的ASCII码值为48)
#include<stdio.h>
main()
{ char C1, C2;
scanf("%d", &c1);
c2=c1+9;
printf("%c%c/n", c1, c2);
}
若程序运行时从键盘输入48<回车>,则输出结果为______。
填空题以下程序的输出结果是{{U}} 【18】 {{/U}}。
#include<stdlib.h>
main()
{ char *s1,*s2,m;
s1=s2=(char*)malloc(sizeof(char));
*s1=15; *s2=20; m=*s1+*s2;
printf("%d/n",m);
}
填空题下面程序的输出是 【9】 main() enum ememl=3,em2=1,em3; char*aa[]="AA',"BB","CC","DD" printf("%s%s%/n",aa[em1],aa[em2],aa[em3]);
填空题请补充函数fun(),该函数的功能是:返回字符数组中指定子符的个数,指定字符从键盘输入。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
#define N 80
int fun (char s[],char ch)
{
int i=0, n=0;
while({{U}} {{U}} {{/U}} {{/U}})
{
if({{U}} {{U}} {{/U}} {{/U}})
n++;
i++;
}
{{U}} {{U}} {{/U}} {{/U}};
}
main ( )
{
int n;
char str[N], ch;
clrscr ();
printf ("/nInput a string: /n");
gets (str);
printf ("/nInput a charactor: /n" ;
scanf ("%c",
n=fun (str, ch);
printf("/nnumber of %c:%d", ch, n);
}
填空题下程序的输出结果是{{U}} 【20】 {{/U}}。
# include<stdio.h>
# define MAX_COUNT4
void fun( )
main( )
{ int count;
for(count=1;count<=MAX_COUNT;coun+ +)fun( );
}
void fun( )
{ staic int i;
i + =2;
printf(”%d,i);
}
填空题有以下程序,若运行时从键盘输入:18, 11<回车>,则程序的输出结果是{{U}} [9] {{/U}}。
main()
{ int a,b;
printf("Enter a,b:"); scanf("%d,%d",
while (a!=b)
{ while(a>b) a-=b);
white(b>a) b-=a;
}
printf("%3d%3d/n",a,b);
}
填空题C语言中用______表示逻辑值“真”,用______表示逻辑值“假”。
填空题下列程序的输出结果是______。 # define p(a) printf("%d,",(int)(a)) # define PRINT(a) p(a); printf("the end") main() int i,a=0; for(i=1;i<5;i++) PRINT(a+i); printf("/n");
填空题有以下程序 int fa(int x) return x*x; int fb(int x)return x*x*x; int f(int (*f1)(),int(*f2)(),int x) return f2(x)-f1(x); main() int i; i=f(fa,fb,2);printf("%d/n"i; 程序运行后的输出结果是______。
填空题以下程序运行后的输出结果是{{U}} 【8】 {{/U}}。
main( )
{ int p[7]={11,13,14,15,16,17,18};
int i=0,j=0;
while(i<7
printf("%d/n",j);
}
填空题下面的语句要使指针p指向一个double类型的动态存储单元,请填空。
p =
________
malloc(sizeof(double));
填空题以下程序运行后的输出结果是{{U}} 【10】 {{/U}}。
main()
{ char Cl,c2;
for(c1='0''c2='9';c1<c2;c1++,c2--) printf("%c%c",c1,c2);
printf("/n");
}
填空题下列程序的输出结果是 【13】 。 main() int a[]=2,4,6,*ptr=y<;y++) z=(*(ptr+y)<x?*(ptr+y);x; printf("%d/n",z);
填空题下列给定程序中,函数fun的功能是:将形参给定的字符串、整数、浮点数写到文本文件中,再用字符方式从此文本文件中逐个读入并显示在终端屏幕上。
请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。
注意
:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
void fun{char *s,int a,double f)
{
/********found********/
______fp;
char ch;
fp=fopen("file1.txt","w");
fprintf(fp,"%s%d%f/n",s,a,f);
fclose(fp);
fp=fopen("file1.txt","r");
printf("/nThe result:/n/n");
ch=fgetc(fp);
/********found********/
while(!feof(______)){
/********found********/
putchar(______);ch=fgetc(fp);}
putchar("/n");
fclose(fp);
}
main()
{char a[10]="Hello!";int b=12345;
double c=98.76;
fun(a,b,c);
}
填空题下列程序输出结果是______。 #include<stdio.h> main() int i,j,sum; for(i=3;i>=1;i--) sum=0; for(j=1;j<=i;j++)sum+=i*j; printf("%d/n",sum);
填空题下列软件系统结构图的宽度为________。
填空题若有定义floatb[15],*p=b;,且数组b的首地址为200H,则p/13所指向的数组元素的地址为______。
填空题表达式(int)((double)(5/2)+2.5)的值是{{U}} 【6】 {{/U}}
填空题以下程序的输出结果是 【6】 。 main() int i=010,j=10; printf("%d,%d/n",i,j);
填空题下面的程序可对指定字符串中的字符串进行从大到小排序,请将程序填完整。 (注:程序采用了冒泡排序法) #include<stdio.h> #include<string.h> main() char*str="ABCDabcd",temp; int n,i; n=strlen(str); while(n-->1) for(i=0;i<n;i++) if(str[i]<str[i+l]) temp= 【12】 ; str[i]=str[i+l]; 【13】 =temp; printf( 【14】 );
