填空题模式/内模式映射为数据库提供了 【1】 数据独立性。
填空题若有下列定义和语句: char*s1="12345",*s2="1234"; printf("%d/n",strlen(strcpy(s1,s2))); 则输出结果为______。
填空题请补充函数fun(),该函数的功能是:把字符下标为非素数的字符从字符串sb中删除,把字符下标为素数的字符重新保存在字符串e口中。字符串sb从键盘输入,其长度作为参数传入函数fun()。
例如,输入“abcdefghijkl”,输出“cdfhl”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
#define N 80
void fun(char s[],int n)
{
int i, j, k, flag;
{{U}}【1】 {{/U}};
for(i=0; i<n; i++)
{
if (i>1)
s [k++] =s [i];
flag=I;
for({{U}} 【2】 {{/U}}; j<i j++)
if (i%j==0)
{
flag=0;
{{U}} 【3】 {{/U}}
}
}
s [k]='/0';
}
main()
{
int i=0, strlen=0;
char str[N];
clrscr ();
printf("/n Input a string:/n");
gets (str);
while (str [i] !='/0')
{
strlen++;
i++;
}
fun (str, strlen);
printf("/n*** display string ***/n");
puts (str);
}
填空题以下程序的输出结果是{{U}} {{/U}}。 #include<stdio.h> main() int a=0; a+ =(a=8); printf("%d//n",a);
填空题以下程序的输出是 【7】 。 main() char str1[]=How do you do",*p=strl; strcpy(str1+strlen(str1)/2"es she"); pfinff("%s/n",p1);
填空题给定程序中,函数fun的功能是:计算形参x所指数组中N个数的平均值(规定所有数均为正数),将所指数组中大于平均值的数据移至数组的前部,小于等于平均值的数据移至x所指数组的后部,平均值作为函数值返回,在主函数中输出平均值和移动后的数据。
例如,有10个正数:46、30、32、40、6、17、45、15、48、26,平均值为30.500000。
移动后的输出为:46、32、40、45、48、30、6、17、15、26。
请在程序的下划线处填入正确的内容,使程序得出正确的结果。
注意:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdlib.h>
#include<stdio.h>
#define N 10
double fun(double *x)
{int i,j;double s,av,y[N];
s=0;
for(i=0; i<N;i++)s=s+x[i];
/**********found**********/
av=______;
for(i=j=0;i<N;i++)
if(x[i]>av){
/**********found**********/
y[______]=x[i];x[i]=-1;}
for(i=0; i<N: i++)
/**********found**********/
if(x[i]!=______)
y[j++]=x[i];
for(i=0;i<N;i++)x[i]=y[i];
return av;
}
main()
{int i;double x[N];
for(i=0; i<N; i++)
{x[i]=rand()%50;
printf("%4.0f",x[i]);}
printf("/n");
printf("/nThe average is:%f/n",funIx));
printf("/nThe result:/n",fun(x));
for(i=0;i<N;i++)
printf("%5.0f",x[i]);
printf("/n");
}
填空题fun( )函数的功能是首先对a所指的N行N列的矩阵,找出各行中的最大的数,再求这N个最大值中 的最小的那个数作为函数值返回,请填空。
#include<stdio.h>
#define N 100
int fun(int( * a)[N])
{ in(row,col,max,min;
for(row=0;row<N;row++)
{ for(max=a [row][0],col=1;col<N;col++)
if(【 】)max=a[row][col];
if(row= =0)min=max;
else if(【 】)min=max;
}
return min;
}
填空题表示条件10<x<100或x<0的C语言表达式是 【6】 。
填空题下列程序的输出结果是 ______。#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");
填空题以下程序的输出结果是 【17】 。 void fun() static int a=0; a+=2; printf("%d",A) ; main() int cc; for(cc=1;cc<4;cc++)fun(); printf("/n");
填空题下列程序的输出结果是 【8】 。 main() int a=1,b=2; a=a+b;b=a-b,a=a-b; printf("%d,%d/n",a,b) ;
填空题有以下程序段
s=1.0;
for(k=1,k<=n;k++) s=s+1.0(k*(k+1));
printf(“%f\n”,s);
请填空,使以下程序段的功能与上面的程序段完全相同。
s=1.0; k=1;
while( )
{ s=s+1.0(k*(k+1)); k=k+1;}
printf(“%f\n”,s);
填空题下列程序的运行结果为{{U}} {{U}} {{/U}} {{/U}}。
main ( )
{ int i, j, row=0, colum=0, max,
a[3] [4]={{1,2,3,4}, {9,8,7,6}, {-10,10,-5,2}};
max=a[0] [0];
for (i=0;i<3;i++)
for (j=0; j<4; j++)
if (max<a [i] [j])
{ max=a[i] [j];
row=i;
colum=j;
}
printf("max=%-5d row=%-3d colum=%-3d/n",max, row, colum);
}
填空题请补充函数fun(),它的功能是:计算并输出n(包括n)以内能被3或7整除的所有自然数的倒数之和。
例如,在主函数中从键盘给n输入32后,输出为:s=1.226323。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
double fun(int n)
{
int i;
double sum=0.0;
if (n>0{{U}} 【1】 {{/U}};i++)
if({{U}} 【2】 {{/U}})
sum+={{U}} 【3】 {{/U}};
}
return sum;
}
main()
{
int n;
double s;
printf("/nInput n:");
scanf("%d",
s=fun(n);
printf("/n/ns=%f/n",s);
}
填空题语句“int(*ptr)();”的含义是______是指向函数的指针,该函数返回一个血型数据。
填空题下面程序的功能是:将字符数组a中下标值为偶数的元素从小到大排列,其他元素不变。 #include <stdio. h> #include <string.h> main () char a [] ="clanguage", t; int i, j, k; k=strlen (a); for(i=0; i for(j=i+2; j<=k; 【6】 ) if( 【7】 ) t=a[i]; a[i]=a[j]; a[j]=t; puts (a); printf ("/n");
填空题阅读下面语句,则程序的执行结果是{{U}} 【7】 {{/U}}。
#include "stdio.h"
main()
{ int a=-1,b=1,k;
if((++a<0)&&! (b--<=0))
printf("%d,%d/n",a,b);
else printf("%d,%d/n",b,a);}
填空题下列给定程序中,函数fun的功能是:将形参s所指字符串中的数字字符转换成对应的数值,计算出这些数值的累加和作为函数值返回。
例如,形参s所指的字符串为abs5def126jkm8,程序执行后的输出结果为22。
请在程序的下划线处填入正确的内容,使程序得出正确的结果。
注意:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
#include<string.h>
#include<ctype.h>
inc fun(char*s)
{int sum=0;
while(*s)
{
/********found********/
if(isdigit(*s))sum+=*s-______;
/********found********/
______;
}
/********found********/
return______;
}
main()
{char s[81];int n;
printf("/nEnter a string:/n/n");gets(s);
n=fun(s);
printf("/nThe result is:%d/n/n",n);
}
填空题若输入3、4、5,程序的输出结果为{{U}} 【6】 {{/U}}。
#include "math.h"
main ( )
{ float a, b, c, s, area;
scanf("%f,%f,%f",
s=1.0/2*(a+b+c);
area=sqrt (s* (s-a) * (s-b) * (s-c));
printf ("a=%7.2f,b=%7.2f, c=%7.2f, s=%7.2f", a,b, c, s);
printf ("area=%7.2f/n", area);
}
填空题以下程序运行结果是 【10】 。 #include<stdio.h> long fib(int g) switch(g) case 0:return 0; case 1: case 2:return 1; return(fib(g-1)+fib(g-2)); main() long k; k=fib(5); printf("k=%5ld/n",k);
