填空题若要使指针p指向一个double类型的动态存储单元,请填空。
p={{U}} 【11】 {{/U}}malloc(sizeof(double));
填空题十进制数53转换为十六进制数为{{U}} 【7】 {{/U}}。
填空题下列给定程序中,函数fun的功能是:求S的值。例如,当k为10时,函数的值应为1.533852。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!试题程序:#include<stdlib.h>#include<conio.h>#include<stdio.h>#include<math.h>/*********found*********/fun(intk){intn;floats,w,p,q;n=1;s=1.0;while(n<=k){w=2.0*n;p=w-1.0;q=w+1.0;s=s*w*w/p/q;n++;}/*********found*********/returns}voidmain(){system("CLS");printf("%f/n",fun(10));}
填空题下面程序的运行结果是 【17】 。 typedef union student char name[10]; long sno; char sex; float score[4]; STU; main() STU a[5]; printf("%d/n",sizeof(a));
填空题以下程序的输出结果是 【14】 。 main() int x=0; sub(&x,8,1); printf("%d/n",x); sub(int *a,int n,int k) if(k<=n)sub(a,n/2,2*k); *a+=k;
填空题以下程序通过函数SunFun求。这里f(x)=x2+l,由F函数实现。请填空。main()printf("Thesum=%d/n",SunFun(10));SunFun(intn)intx,s=0;for(x=0;x<=n;x++)S+=F(______);returns;F(intx)return(______);
填空题请补充main函数,该函数的功能是:计算三名学生学科的平均成绩。
例如,当score[N][M]={{83.5,82,86,65,67},{80,91.5,84, 99,95},{90,95,86,95,97}时,五门学科的平均分为:84.5 89.5 85.3 86.3 86.3。
注意:部分源程序给出如下。
请勿改动主函数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, 95, 86, 95, 97} };
static float bb[N];
clrscr ();
for ( i=0; i<M; i++)
bb[i]=0.0;
for(i=0;i<{{U}} 【1】 {{/U}};i++)
{
for(j=0;j<{{U}} 【2】 {{/U}};j++)
bb [j]+=score [i] [j];
}
for (i=0; i<M; i++)
print f (" /nsubject%d/taverage=%5.1 f",
i+1,{{U}} 【3】 {{/U}});
return 0;
}
填空题在二维表中,元组的【 】不能再分成更小的数据项。
填空题下列给定程序中,函数proc()的功能是计算正整数m各位上数字的平方和。
例如,输入498,则输出应该是161。
请修改程序中的错误,使它能得到正确结果。
注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
long proc(long m)
{
//****found****
long sum=1;
do
{
sum+=(m%10)*(m%10);
m/=10;
//****found****
}
while(m)
return(sum);
}
void main()
{
long n;
system("CLS");
printf("Please enter a number:");
scanf("%1d",
printf("/n%1d/n",proc(n));
}
填空题给定程序中,函数fun的功能是计算下式直到,并把计算结果作为函数值返回。例如:若形参e的值为1e-3,函数的返回值为0.551690。请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。注意:源程序存放在考生文件夹下的BLANK1.C中。不得增行或删行,也不得更改程序的结构!给定源程序如下。#include<stdio.h>doublefun(doublee){inti,k;doubles,t,x;s=0;k=1;i=2;/*********found*********/x=________/4;/**********found********/while(x________e){s=s+k*x;k=k*(-1);t=2*i;/********found*******/x=________/(t*t);i++;}returns;}main(){doublee=1e-3;printf("/nTheresultis:%f/n",fun(e));}
填空题有以下程序: #include <stdio.h> main() int t=1,i=5; for(;i>=0;i--) t*=i; printf("%d/n",t); 执行后的输出结果是 【8】 。
填空题数据的逻辑结构有线性结构和{{U}} 【1】 {{/U}}两大类。
填空题下列给定程序中,函数fun()的功能是:删除字符串s中所有空白字符(包括Tab字符、回车符及换行符)。输入字符串时用’#’结束输入。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构. 试题程序: #include <string.h> #include <stdio.h> #include <ctype.h> fun(char *p) int !i, t; char c[80]; for(i=0,t=0;p[i];i++) if(!isspace(*(p+i))) c[t++]=p[i]; /**********************************/ c[t]='/0'; strcpy(p,c); main() char c,s[80]; int i=0; printf("Input a string: "); c=getchar(); while(c!='#') ( s[i]=c;i++;c=getchar(); s[i]="/0"; fun(s); puts(s);
填空题以下程序运行后的输出结果是______。 main ( ) int a[4] ]4]=1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18; int i=0.j=0,s=0; while (i++<4 if (i == 2 || i == 4)continue; j =0; do s += a[i] [j]: j++; while (j<4); printf ( "%d/n", s); void fun(int x, int y)
填空题以下函数把b字符串连接到a字符串的后面,并返回a中新字符串的长度。请填空。 surcen(chara[],char b[]) int num=0,n=0; while(*(a+num)!=______)num++; while(b[n])*(a+num)=b[n];num++;______; return(num); _'/o'或0
填空题以下程序运行后的输出结果是{{U}} 【16】 {{/U}}。
struct NODE
{
int num;
stmct NODE *next;
};
main()
{struct NODE s[3]={{1,'/0'),{2,'/0'),{3,'/0'}),*p,*q,*r;
int sum=0;
s[0].next=s+1;
s[1].next=s+2;
s[2].next=s;
p=s
q=p->next;
r=q->next;
sum+=q->next->num;
sum+=r->next->next->num;
printf("%d/n",sum);
}
填空题请补充函数fun(),该函数的功能是:把从主函数中输入的字符串str2接在字符串str1的后面。 例如:str1=“How do”,str2=“you do?”,结果输出:How do you do? 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #include<conio.h> #define N 40 void fun(char *str1,char *str2) int i=0; char *p1=str1; char *p2=str2; while( 【1】 ) i++; for( ; 【2】 ;i++) *(p1+i)= 【3】 ; *(p1+i)='/0'; main() char str1[N],str2[N); clrscr(); printf("*****Input the string str1 & str2*****/n"); printf("/nstr1:"); gets(str1); printf("/nstr2:"); gets(str2); printf("**The string str1 & str2**/n"); puts(str1); puts(str2); fun(str1,str2); printf("*****The new string *****/n"); puts(str1);
填空题以下程序运行后的输出结果是{{U}} 【6】 {{/U}}。
#include <stdio.h>
int a=5;
fun (int b)
{ static int a=10;
a+ =b++;
printf("%d",a);
}
main()
{ int c=20;
fun(c);
a+ =c++;
printf("%d/n",a);
}
填空题条件“20<x<30或x<-100”的C语言表达式是 【10】 。
填空题在面向对象方法中 【1】 描述的是具有相似属性与操作的一组对象。
