填空题当循环队列非空且队尾指针等于队头指针时,说明循环队列已满,不能进行人队运算。这种情况称为{{U}} 【3】 {{/U}}。
填空题以下函数把b字符串连接到a字符串的后面,并返回a中新字符串的长度。请填空。 strcen(char a[],char b[]) int num=0,n=0; while(*(a+num)!= 【16】 )num++; while(b[n])*(a+num)=b[n];num++; 【17】 ; return(num);
填空题请补充main函数,该函数的功能是:求1+21+3!+…+N!的和。 例如, 1+2!+3!+...+5!+6!的和为873。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。 试题程序: #include <stdio.h> main ( ) int i, n; long s=0, t=l; clrscr (); printf ("/nInput n: /n"); scanf ("%d", 【1】 ); for (i=l; i<=n; i++) t= 【2】 ; s= 【3】 ; printf ("1 ! +2 ! +3 !... +%d! =%ld/n", n, s);
填空题下列语句的输出结果是______。 char s[20]="aaaa",*sp=s; puts(strcat(sp,"AAAAA"));
填空题执行下列程序的输出结果是 【6】 。 main() float a = 1,b; b=++a* ++a; printf("%f/n",b);
填空题给定程序中,函数fun的功能是:将形参std所指结构体数组中年龄最大者的数据作为函数值返回,并在main函数中输出。 请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。 注意:部分原程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在行线上填入所编写的若干表达式或语句。 [试题源程序] #include<stdio.h> typedef struct char name[10]; int age; STD; STD fun(STD std[],int n) STD max;int i; /**********found**********/ max= (1) ; for(i=1;i<n;i++) /**********found**********/ if(max.aged (2) ) max=mtd[i]; return max; main() STD std[5]="aaa",17,"bbb",16,"ccc",18,"ddd",17,"ee",15; STD max; max=fun(std,5); printf("/nThe result:/n"); /**********found**********/ printf("/nName:%s,Age:%d/n", (3) ,max.age);
填空题以下程序的输出结果是 【20】 。 #define MAX(x,y) (x)>(y)?(x):(y) main() int a=5,b=2,c=3,d=3,t; t=MAX(a+b,c+d) *10; printf("%d/n",t);
填空题请补充函数proc(),该函数的功能是:依次取出字符串中所有的小写字母以形成新的字符串,并取代原字符串。
例如,若输入:everyONE!,则输出:every。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
void proc(char*str)
{
int i=0;
char*p=str;
while(______)
{
if(*p>="a"
______;
}
p++;
}
str[i]=______;
}
void main()
{
char str[80];
system("CLS");
printf("/nEnter a string: ");
gets(str);
printf("/n/nThe string is: %s/n", str);
proc(str);
printf("/n/nThe string of changing is: %s/n", str);
}
填空题下列程序执行输出的结果是 【19】 。 #include<stdio.h> f(int a) int b=0; static c=3; a=c++,b++; return(a); main() int a=2,i,k; for(i=0;i<2;i++) k=f(a++); printf("%d/n",k);
填空题给定程序中,函数fun的功能是将a和b所指的两个字符串分别转换成面值相同的整数,并进行相加作为函数值返回,规定字符串中只含9个以下数字字符。
例如,主函数中输入字符串32486和12345,在主函数中输出的函数值为44831。
请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。
注意:源程序存放在考生文件夹下的BLANK1.C中。
不得增行或删行,也不得更改程序的结构!
给定源程序如下。
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#define N 9
long ctod(char*s)
{ long d=0;
while(*s)
if(isdigit(*s)){
/***********found**********/
d=d*10+*s-______;
/***********found*********/
______;}
return d;
}
long fun(char *a,char *b)
{
/***********found**********/
return ______;
}
main()
( char s1[N],s2[N];
do
{ printtf"Input string s1:");gets(s1);}
while(strlen(s1)>N);
do
{ printf("Input string s2:");gets(s2);}
while(strlen(s2)>N);
printf("The result is:%ld/n",fun(s1,s2));
}
填空题在宏定义#define P13.14159中,用宏名PI代替一个______。
填空题下列给定程序中,函数fun()的功能是逐个比较a,b两个字符串对应位置中的字符,把ASCII值小或相等的字符依次存放到c数组中,形成一个新的字符串。
例如:a中的字符串为fshADfg,b中的字符串为sdAEdi,则c中的字符串应为fdAADf。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <stdio.h>
#include <strinq.h>
void fun(char *p,char *q,char *c)
{ int k=0;
while(*p || *q)
/**********found**************/
{ if (*p<=*q)
c[k]=*q;
else c[k]:*p;
if(*p) p++;
if(*q) q++;
/**+**********found**************/
k++
}
}
main()
{char a[10]="fshADfg",b[10]="sdAEdi",
c[80]={'/0');
fun(a,b,c);
printf("The string a:");puts(a);
printf("The string b:");puts(b);
printf("The result:");puts(c);
}
填空题请补充main函数,该函数的功能是:计算每个学生成绩的平均分,并把结果保存在数组bb中。 例如,当scorer[N][M]=83.5,82,86,65,67),80,91.5,84, 99,95)90.5,95,86,95,97时,三个学生的平均分为76.7 89.9 92.7。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若千表达式或语句。 试题程序: #include<stdio.h> #define N 3 #define M 5 main() int i,j; static float score[N][M]=83.5,82,86, 65,67,80,91.5,84,99,95,90.5,95, 86,95,97; float bb[N]; clrscr(); for(i=0;i<N;i++) 【1】; for(i=0;i<N;i++) for (j=0; j<M; j++) 【2】; bb [i]/=M; for (i=0; i<N; i++) print f (" knstudent %d/t average =%5.1f",i+l,bb[i]);
填空题下列给定程序中,函数proc()的功能是:根据整型参数m,计算如下公式的值:
y=1/(100100)+1/(200200)+1/(300300)+…+1/(mm)
例如,若m=4000,则应输出0.000162。
请修改程序中的错误,使它能得出正确的结果。
注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdlib.h>
#include<conio.11>
#include<stdio.h>
//****found****
proc(int m)
{
double y=0,d;
int i;
//****found****
for(i=100,i<=m,i+=100)
{
d=(double)i*(double)i;
y+=1.0/d;
}
return(y);
}
void main()
{ int n=4000;
system("CLS");
printf("/nThe result is%1f/n",proc(n));
}
填空题关系模型的3类完整性指的是 【2】 、参照完整性、用户定义的完整性。
填空题若已经定义int a=25,b=14,c=19;,以下三目运算符(?:)所构成的语句的执行结果是 【9】 。 a++ a=%d,b=%d,c=%d/n",a,b,C) :printf("a=%d,b=%d,c=%d/n",a,b,C) ;
填空题下列给定程序中,函数fun的功能是:将S所指字符串中的所有数字字符移到所有非数字字符之后,并保持数字字符串和非数字字符串原有的次序。
例如,s所指的字符串为“def35adh3kjsdf7”,执行后结果为“defadhkjsdf3537”。
请在程序的下划线处填入正确的内容,使程序得出正确的结果。
注意:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
void fun(char *s)
{
int i,j=0,k=0;
char t1[80],t2[80];
for(i=0;s[i]!="/0";i++)
if(s[i]>="0"
______;
}
else
{
t1[k++]=s[i];
}
t2[j]=0;
t1[k]=0;
for(i=0;i<k;i++)
______;
for(i=0;i<______;i++)
s[k+i]=t2[i];
}
main()
{
char s[80]="ba3a54j7sd567sdffs";
pfintf("/nThe original string is:%s/n",s);
fun(s);
pfintf("/nThe result is:%s/n",s);
}
填空题以下程序中,select函数的功能是:在N行M列的二维数组中,选出一个最大值作为函数值返回,并通过形参传回此最大值所在的行下标。请填空。
#define N 3
#define M 3
select(int a[N][M],int *n)
{ int i,j,row=1,colum=1;
for(i=0;i<N;i++)
for(j=0;j<M;j++)
if(a[i][j]>a[row][colum]){row=i;colum=j;}
*n={{U}} 【17】 {{/U}};
return({{U}} 【18】 {{/U}});
}
main()
{ int a[N][M]={9,11,23,6,1,15,9,17,20},max,n;
max=select(a,&n);
printf(“max=%d,line=%d/n”,max,n);
}
填空题若有程序:
main()
{ int i,j;
scanq("i=%d,j=%d",
printf("i=%d,j=%d/n",i,j);
}
要求给i赋10,给j赋20,则应该从键盘输入{{U}} 【7】 {{/U}}。
填空题若有如下结构体说明: struct STRU int a,b;charc:double d; struct STRU*p1,*p2; 请填空,以完成对t数组的定义,t数组的每个元素为该结构体类型。 【11】 t[20]
