填空题以下程序运行后的输出结果是______。 main() int a,b,c; a=10;b=20;c=(a%b<1)||(a/b>1); printf("%d%d%d/n",a,b,c);
填空题以下程序运行后的输出结果是______。 main() int x,a=1,b=2,c=3,d=4; x=(a<b)? a:b;x=(x<c)? x:c;x=(d>x)? x:d; pfintf("%d/n",x);
填空题请补充函数proc(),该函数的功能是:计算下面公式的值(k<50):例如,当k=6时,m=6515.100198。注意:部分源程序已给出。请勿改动主函数main和其他函数中的任何内容。试题程序:#include<stdlib.h>#include<conio.h>#include<stdio.h>doubleproc(intn)doublem=(1);doublef=0.0;doublep=0.0;inti=0;intk;for(k=1;(2);k++)f=2*k-1;p=2*k+1;for(i=1;i<2*k+1;i++)f*=2*k-1;for(i=1;i<2*k=1;i++)p*=2*k+1;(3);returnm;voidmain()intk=0;doublem;system("CLS");printf("/nPleaseinputk(k<50):");scanf("%d",m=proc(k);printf("/nS=%1f",m);
填空题以下程序运行后的输出结果是{{U}} [7] {{/U}}。
main()
{int m=011, n=11;
printf("%d %d/n",++m,n++);
}
填空题当线性表的元素总数基本稳定,且很少进行插入和删除操作,并要求以很快的速度存取线性表中的数据元素时,应采用 【1】 存储结构。
填空题以下程序的功能是:借助指针变量找出数组元素中的最大值及其元素的下标值,请填空。 #include<stdio.h> main() int a[10],*p,*s; for(p=a;p-a<10;p++)scanf("%d",p); for(p=a;s=a;p-a<10;p++)if("p>*s)s=______; printf("index=%d/n",s-a);
填空题以下程序中用户由键盘输入一个文件名,然后输入一串字符(用$结束输入)存放到此文件中,形成文本文件,并将字符的个数写到文件尾部。请填空。
#include <string.h>
main()
{ FILE*fp:
char ch,fname[32] int count=0:
prinft("input the filename:"): scanf("%s",fname);
if((fp=fopen(______,"w+"))==NULL)
{ printf("can't open file:%s/n",fname);
exit(0):
}
printf("enter data:/n"):
while((ch=getchar())!='$')
{fputc(ch,fp): count++; }
fprintf(______,"/n%d/n", count);
fclose(fp):
}
填空题下列给定的程序中,fun()函数的功能是:将p所指的字符串中每个单词的最后一个字母改成大写(这里的“单词”是指有空格隔开的字符串)。
例如,若输入:I am a student to take the examination 则应输出:I aM
A studenT tO takE thE examinatioN
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。
试题程序 #include
<stdlib.h> #include <string.h> #include
<conio.h> #include <ctype.h > #include
<stdio.h> void fun(char*p) { int
k=0; for(;*p; p++) if(k) { /*
* * * *found* * * * * / if(p=='') {
k=0; /* * * * *found* * * * * / *p=toupper(
*(p-1)); } } else
k=1; *p=toupper(*p); } void
main() { char chrstr[64]; int d;
printf("/nPlease enter an English sentence within 63
letters:"); gets(chrstr);
d=strlen(chrstr); chrstr[d]='';
chrstr[d+1]=0; printf("/nBefore changing:/n % s",
chrstr); fun(chrstr); printf("/nAfter
changing:/n % s", chrstr); }
填空题函数voidfun(float*sn,intn)的功能是:根据以下公式计算s,计算结果通过形参指针sn传回;n通过形参传入,n的值大于等于0。请填空。voidfun(float*sn,intn)floats=0.0,w,f=-1.0;inti=0;for(i=0;i<=n;i++)f=【15】*f;w=f/(2*i+1);s+=w;【16】=s;
填空题请补充main()函数,该函数的功能是:打印出满足个位的数字、十位上的数字和百位上的数字都相等的所有3位数。
本题的结果为:111 222 333 444 555 666 777 888 999。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在main()函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdlib.h>
#include<stdio.h>
void main()
{
int a, b, c;
system("CLS");
for(a=1; a<10; a++)
for(b=1; b<10; b++)
for(c=1; c<10; c++)
{
if(______)
printf("%5d", ______);
}
}
填空题函数my_cmp()的功能是比较字符串s和t的大小,当s等于t时返回0,否则返回s和t的第一个不同字符的ASCII码差值,即s>t时返回正值,当s<t时返回负值。请填空。 my_cmp(char *s,char*t) while(*s==*t) if(*s=='/0')return 0; ++s; ++t; return______;
填空题若已定义:int a=3, b=15, c; ,则语句c=a>b;运行后c的值为______。
填空题软件生命周期包括2今阶段。为了使各时期的任务更明确,又可分为3个时期:软件定义期、软件开发期、软件维护期。编码和测试属于{{U}} 【3】 {{/U}}期。
填空题下列给定程序中函数fun的功能是:计算并输出high以内最大的10个素数的和。high的值由主函数传给fun函数。
例如,若high的值为100,则函数的值为732。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
#include <conio.h>
#include <stdio.h>
#include <math.h>
int fun(int high)
{ int sum=0, n=0, j, yes;
/* * * * * * * * * *found* * * * * * * * * * /
while((high>=2)
for (j=2; j<=high/2; j++)
if(high% j==0)
{ /* * * * * * * * * *found* * * * * * * * * * /
yes=0; break
}
if(yes)
{ sum+=high;
n++;
}
high--;
}
return sum;
}
main()
{ printf("% d", fun(100));
}
填空题表达式s=10应当读做“______”。
填空题以下程序运行后的输出结果是 【16】 。 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) ); prind("/n");
填空题以下程序的输出结果是【 】。
#define MCRA(m) 2*m
#define MCRB(n,m) 2*MCRA(n)+m
main( )
{ int i=2,j=3;
printf("%d\n",MCRB(j,MCRA(i)));
}
填空题实体之间的联系可以归结为一对一的联系,一对多的联系与多对多的联系。如果一个学校有许多教师,而一个教师只归属于一个学校,则实体集学校与实体集教师之间的联系属于______的联系。
填空题若有下列定义(设int类型变量占两个字节),则i={{U}} 【6】 {{/U}},j={{U}} 【7】 {{/U}}。
int i=8,j=9;float x=123.456;
print("i=%oj=%o/n",i,j);
填空题给定程序中函数fun的功能是:将字符串中的字符按逆序输出,但不改变字符串中的内容。
例如,若字符串为abcd,则应输出:dcha。
请改正程序中的错误,使它能计算出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
给定源程序:
#include<stdio.h>
/************found************/
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");
}
