填空题在关系A(S,SN,D)和关系B(D,CN,NM)中,A的主关键字是S,B的主关键字是D,则称 【5】 是关系A的外码。
填空题以下程序的功能是:输出100以内(不含100)能被3整除且个位数为6的所有整数,请填空。 main() int i,j: for(i=0; (11) ;i++) j=i*10+6; if (12) lconfinue; prinf("%d",j);
填空题有以下定义和语句,则sizeof(a) 的值是{{U}} 【11】 {{/U}},而sizeof(a,share)的值是{{U}} 【12】 {{/U}}
struct date
{ int day;
int mouth;
int year;
union{int share1;
float share2;
}share;
}a;
填空题软件开发过程主要分为需求分析、设计、编码与测试四个阶段,其中______阶段产生“软件需求规格说明书”。
填空题以下程序用以删除字符串中所有的空格,请填空。 #include<stdio.h> main() char s[100]=("Our teacher teach C language!");int i,j; for(i=j=0;s[i]!='/0';i++) if(s[i]!='')(s[j])=s[i];i++;) s[j]=______; printf("%s/n",s);
填空题以下程序中用户由键盘输入一个文件名,然后输入一串字符(用#结束输入)存放到此文件中,形成文本文件,并将字符的个数写到文件的尾部。请填空。
#include<stdio.h>
main()
{ FILE *fp;
char ch,fname[32]; int count=0;
printf(”Input the filename:");
scanf("%s",fname);
if((fp=fopen({{U}} 【12】 {{/U}},"w+"))==NULL)
{ printf("Can't open file:%s/n",fname);exit(0);}
printf("Enter data:/n");
while((ch=getchar())!='#')
{ fputc(ch,fp);count++;}
fprintf({{U}} 【13】 {{/U}},"/n%d/n",count);
fclose(fp);
}
填空题下列程序中的数组a包括10个整数元素,分别将前项和后项之和存入数组b,并按每行4个元素输出数组b。请填空。
#include<stdioh>
main()
{int a[10],b[10],i;
for(i=0;i<10;i++)
scanf("%d",
for(i=0;i<9;i++)
for(i;0;i<9;i++)
{if(i%4==0)primf("/n");
printf("%3d",b[i];
}
}
填空题若a=l,b=2,则表达式!(x=a)||y=b)&&0的值是______。
填空题数据独立性分为逻辑独立性与物理独立性。当数据的存储结构改变时,其逻辑结构可以不变,因此,基于逻辑结构的应用程序不必修改,称为 【5】 。
填空题给定程序中,函数fun()的功能是:求输入的两个数中较小的数。 例如:输入5 10,结果为min is 5。 请改正fun()程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序、 #include <stdio. h> #include<conio. h> /*************found**************/ int fun(int x, y) int z; z=x<y?x: y; return (z); main ( ) int a,b,c; scanf ("%d, %d/n", c=fun (a, b); printf ("min is %d", c);
填空题已有定义:double*p;,请写出完整的语句,利用malloc函数使p指向一个双精度型的动态存储单元 【4】 。
填空题当先后输入1、3、4、12、23时,屏幕上出现 【11】 ;再输入12时,则屏幕上出现 【12】 。#include <stdio.h>#define N 5main() int i,j,number,top,bott,min,loca,a[N],flag; char c; printf("Please input 5 numbers (a[i]>a[i-1])/n"); scanf("%d",&a[0]); i=1; while (i<N) scanf("%d",&a[i]); if (a[i]>=a[i-1)) i++; printf("/n"); for (i=0;i<N;i++) printf("%d",a[i]); printf("/n"); flag=1; while (flag) scanf("%d",&number); loca=0; top=0; bott=N-1; if ((number<a[0])||(number>a[N-1])) loca=-1; while ((loca==0) && (top<=bott)) min=(bott+top)/2; if (number==a[min]) loca=min; printf("%d is the %dth number/n",number,loca+1); else if (number<a[min]) bott=min-1; else top=min+1; if (loca==0||loca==-1) printf("%d is not in the list./n",number); c=getchar(); if (c=='N'||c=='n') flag=0;
填空题给定程序中,函数fun的功能是:找出N×N矩阵中每列元素中的最大值,并按顺序依次存放于形参b所指的一维数组中。
请在程序的下划线处填入正确的内容,使程序得出正确的结果。
注意:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
#define N 4
void fun(int(*a)[N],int*b)
{int i,j;
for(j=0;i<N;i++){
/**********found**********/
b[i]=______;
for(j=1;j<N;j++)
/**********found**********/
if(b[i]______a[j][i])
b[i]=a[j][i];
}
}
main()
{int x[N][N]={{12,5,8,7},{6,1,9,3},{1,2,3,4},{2,8,4,3}},y[N],i,j;
printf("/nThe matrix:/n");
for(i=0;i<N;i++)
{for(j=0;j<N;j++)printf("%4d",x[i][j]);
printf("/n");
}
/**********found**********/
fun(______);
printf("/nThe result is:");
for(i=0;i<N;j++)
printf("%3d",y[i]);
printf("/n");
}
填空题有以下程序: main() int n=0,m=1,x=2; if(!n)x-=1; if(m)x-=2; if(x)x-=3; printf("%d/n",x); 执行后输出的结果是 [10] 。
填空题以下程序的功能是:借助指针变量找出数组元素中最大值所在的位置并输出该最大值。请在输出语句处填写代表最大值的输出项。
#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=p;
printf("max=%d/n",{{U}} (14) {{/U}};
}
填空题下列给定程序中,函数fun()的功能是:将大写字母转换为对应的小写字母之后的第5个字母;若小写字母为v~z,使小写字母的值减21。转换后的小写字母作为函数值返回。例如,若形参是字母A,则转换为小写字母f;形参是字母W,则转换为小写字母b。
请改正函数fun()中的错误,使它能得出正确的结果。
注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。
试题程序 #include
<stdio.h> #include <ctype.h > char fun(char
c) { if(c>='A' if(c>='a' else if(c>='v' return c; }
main() { char c1, c2; printf("/nEnter a letter
(A-Z):"); c1=getchar();
if(isupper(c1)) { c2=fun(c1); printf("/n/nThe
letter % c change to % c/n" c1, c2); }
else printf "/nEnter (A-Z) ! /n"); }
填空题以下程序运行后的输出结果是______。 #inClude <strinq.h> char *ss(char *s) char *p;t; p=S+1;t=*s; while(*p)*(p-1)=*p;p++; *(p-1)=t; return s; main() char *p,str[10]="abcdefgh"; p=ss(str); printf("%s/n",p);
填空题函数void fun(float*sn,int n)的功能是:根据以下公式计算S,计算结果通过形参指针sn传回;n通过形参传入,n的值大于等于0。请补全程序。 S=1-1/3+1/5-1/7+…+1/(2n+1) void fun(float*sn,int n) float s=0.0,w,f=-1.0; int i=0; for(i=0;i<=n;i++) f= 【14】 *f; w=f/(2*i+1); s+=w; 【15】 =s;
填空题以下程序的输出结果是______。
#include<stdio.h>
int fun2(int a, int b)
{ int c;
c=(a*b)%3; return c;
int fun1(int a, int b)
{ int c;
a+=a; b+=b; c=fun2(a, b);
return c*c;
}
main()
{ int x=11, y=19;
printf("%d/n", fun1(x, y));
}
填空题设文件test. txt中原已写入字符串Begin,执行以下程序后,文件中的内容为______。
#include main() { FILE
*fp; fp=fopen("test.txt","w+");
fputs("test",fp);
fcloset(p); }
