填空题以下程序的输出结果是 【12】 。 #include<stdio.h> main() int a=0; a+ =(a=8); printf("%d/n",a);
填空题程序通过定义学生结构体变量,存储了学生的学号、姓名和三门课的成绩。函数fun的功能是将形参a所指结构体变量s中的数据进行修改,并把a中存储的地址作为函数值返回主函数,在主函数中输出修改后的数据。
例如:a所指变量s中的学号、姓名和三门课的成绩依次是:10001、"ZhangSan"、95、80、88,修改后输出t所指变量的数据应为:10002、"LiSi"、96、81、89。
请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。
不得增行或删行,也不得更改程序的结构!
给定源程序:
#include<stdio.h>
#include<string.h>
struct student{
long sno;
char name[10];
flora score[3];
};
/**********found**********/
______fun(struct student*a)
{int i;
a->sno=10002;
strcpy(a->name,"LiSi");
/**********found**********/
for(i=0;i<3;i++)______+=1;
/**********found**********/
return______;
}
main()
{struct student s={10001,"ZhangSan",95,80,88},*t;
int i;
printf("/n/nThe original data:/n");
printf("/nNo:%ld Name:%s/nScores:",s.sno,s.name);
for(i=0;i<3;i++)printf("%6.2f",s.score[i]);
printf("/n");
t=fun(%s);
printf("/nThe data after modified:/n");
printf("/nNo:%ld Name:%s/nScores:",t->sno,t->name);
for(i=0;i<3;i++)printf("%6.2f",t->score[i]);
printf("/n");
}
填空题在对文件进行操作的过程中,若要是文件位置的指针回到文件的开头,应使用的函数是 【20】 。
填空题若由以下定义,则不移动指针p,且通过指针p引用值为98的数组元素的表达式是______。 int w[10]=23,54,10,33,47,98,72,80,61,*p=w;
填空题层次模型的典型代表是IBM公司的{{U}} 【6】 {{/U}}数据库管理系统。
填空题下列给定程序中,函数fun的功能是:计算正整数num各位上的数字之积。
例如,若输入252,则输出应该是20。若输入202,则输出应该是0。
请改正程序中的错误,使它能得出正确的结果。
注意
:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
#include<conio.h>
long fun(long num)
{
/********found********/
long k;
do
{
k*=num%10;
/********found********/
num/=10;
}while(num);
return(k);
}
main()
{
long n;
printf("/n please enter a number:");
scanf("%ld",
printf("/n%ld/n",fun(n));
}
填空题以下程序中函数huiwen.的功能是检查一个字符串是否是回文,当字符串是回文时,函数返回字符串: yes!,否则函数返回字符串:no!,并在主函数中输出,所谓回文即正向与反向的拼写都一样,例如:adgda。请填空。
#include<string.h>
char *huiwen(char*str)
{ char*p1,*P2;int i,t=0;
P1=str;p2={{U}} 【18】 {{/U}};
for(i=0;i<=strlen(str)/2;i++)
if(*p1++!=*p2--){t=1;break;}
if({{U}} 【19】 {{/U}})return("yes!");
else return("no!");
}
main()
{ char str[50];
printf("Input:");scanf("%s",str);
printf("%s/n",{{U}} 【20】 {{/U}});
}
填空题以下程序运行后的输出结果是{{U}} 【12】 {{/U}}。
fun(int a)
{ int b=0; static int c=3;
b++; c++;
return(a+b+c);
}
main()
{ int i, a=5;
for(i=0; i<3; i++)printf("% d % d", i, fun(a));
printf("/n");
}
填空题下列给定程序中函数fun()的功能是:将字符串中的字符逆序输出,但不改变字符串中的内容。
例如,若字符串为abcd,则应输出:dcba。 请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。
试题程序 #include
<stdio.h> void fun(char*a) { if(*a)
{ fun(a+1); /* * * * *found* * * * * /
printf("% c"*a); } }
main() { char s[10]="abcd"; printf("处理前字符串=%
s/n, 处理后字符串=", s); fun(s);
printf("/n"); }
填空题下面程序把从终端读入的文本(用@作为文本结束标志)复制到一个名为bi.dat的新文件中,请填空。 # include<stdio.h> FILE*fp; main() char ch; if((fp=fopen(______))==NULL) exit(0); while((ch=getchar())!='@')fputc(ch,fp);______;
填空题请补充main()函数,该函数的功能是:输入两个正整数num1和num2,求这两个数的最大公约数和最小公倍数。
例如,若输入的两个正整数为12、4,则它们的最大公约数为4,最小公倍数为12。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在main()函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdlib.h>
#include<stdio.h>
void main()
{
int a, b, num1, num2, t;
system("CLS");
printf("/nInput two numbers: /n");
scanf("%d, %d",
if(num1<num2)
{
a=num2;
b=num1;
}
else
{
a=num1;
b=num2;
}
while(______)
{
t=______
a=b;
b=t;
}
printf("greatest common divisor:
%d/n", a);
printf("least common multiple:
%d/n", ______);
}
填空题队列是限定在表的一端进行插入和在另一端进行删除操作的线性表。允许删除的一端称作______。
填空题以下程序的输出结果是______。 #include main() int a[5]=2,4,6,8,10,*p; p=a;p++; printf("%d",*p);
填空题执行以下程序后,输出'*'号的个数是______。
#include<stdio.h>
main()
{ int i,j;
for (i=1;i<6;i++)
for(j=2;j<=i;j++)putchar('*');
}
填空题以下程序的输出结果是______。
#include<stdio.h>
double sub(double x, double y, double z)
{ y-=1.0; z=z+x; return z; }
main()
{double a=2.5, b=9.0;
printf("%f/n", sub(b-a, a, a));
}
填空题软件生命周期包括8个阶段。为使各时期的任务更明确,又可以分为以下3个时期:软件定义期、软件开发期、软件维护期。编码和测试属于 【3】 期。
填空题以下程序运行后的输出结果是【 】。
main( )
{ int p=30;
printf("%d/n",(p/3>0 ? p/10 : p%3));
}
填空题若有如下程序: main() int s=8,a=3,b=5,c=6; if(a>b) s=a; a=b; b=s; if(a>c) s=a; a=c;b=s); if(b>c) s=b; b=c;c=s; printf("%d,%d,%d/n",a,b,c); 则程序运行后的输出结果是 【11】 。
填空题以下程序的功能是将字符串s中的数字字符放人d数组中,最后输出d中的字符串。例如,输入字符串abc123edf456gh,执行程序后输出123456。请填空。
# include<stdio. h>
# include<ctype. h>
main()
{ char s[80], d[80]; int i, j;
gets(s);
for(i=j=0; s[i]!='/0'; i++)
if({{U}} 【6】 {{/U}}){ d[j]=s[i]; j++;)
d[j]='/0';
puts(D) ;
}
填空题请补充fun函数,该函数的功能是:把字符的ASCII码为奇数的字符从字符串str中删除,结果仍然保存在字符串中,字符串str从键盘输入,其长度作为参数传入fun函数。 例如,输入“abcdef”则输出“bdf”。 注意:部分源程序已给出。 请勿改动主函数main和其他函数中的任何内容,仅在main函数的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #define N 100 void (1) int i,j; (2) ; for(i=0;i<n;i++) char str[N]; printf("please input a string:/n"); gets(str); while(str[i]!='/0') len++; if(s[i]%2==0) s[j++]=s[i]; (3) ; main() int i=0,len=0; i++; fun(str,len); printf("The result string:/n"); puts(str);