填空题下面程序的输出结果是 【12】 。 char b[]="ABCD"; main() char *p=b; for(;*p;p++) printf("%s",p); printf("/n");
填空题设Y是int型变量,请写出判断Y为奇数的关系表达式 【6】 。
填空题以下程序运行后输出的结果是 【9】 。 main() int x=1,y=0,a=0,b=0; switch(x) case 1:switch(y) case 0:a++;break; case 1:b++;break; case 2:a++;b++;break; printf("%d%d/n",a,b) ;
填空题以下程序的功能是输出如下形式的方阵: 13 14 15 16 9 10 11 12 5 6 7 8 1 2 3 4 请填空。 main() int i, j, x; for(j=4; j>0; j--) for(i=1; i<=4; i++) x=(j-1)*4+ 【2】 ; printf("% 4d", x); printf("/n");
填空题下列程序的功能是计算机一元二次方程的根。 #include 【10】 #include <stdio.h> main ( ) float a, b, c, disc, x1, x2, realpart, imagpart; scanf("%f%f%f", printf("The equation"); if( 【11】 <=1e-6) printf(" is not quadratic/n"); else disc=b*b-4*a*c; if (fabs (disc) <=1e-6) printf("has two equal roots:%-8.4f/n",-b/(2*a)); else if( 【12】 ) x1= (-b+sqrt (disc))/(2*a); x2= (-b-sqrt (disc))/(2*a); printf("has distinct real roots:%8.4f and %.4f/n",xl,x2); else realpart=-b/(2*a); imagpart=sqrt (-disc)/(2*a); printf("has complex roots:/n"); printf ("%8.4f+%. 4fi/n", realpart, imagpart); printf ("%8.4f-%. 4fi/n", realpart, imagpart);
填空题若有如下程序: main() int a[][2]=1,2,6,9,11,(*t)[2]; t=a; printf("%d,%d/n",*(t[1]+1), (*t) [1]); 则程序运行后输出的结果是 【20】 。
填空题实现算法所需的存储单元多少和算法的工作量大小分别称为为算法的{{U}} 【1】 {{/U}}。
填空题以下程序的输出结果为 【13】 。 #define JFT(x)x*x main() int a, k=3; a =++ JFT(k+1); printf("%d",a);
填空题按指定格式输出数据到文件中的函数是______,按指定格式从文件输入数据的函数是______,判断文件指针到文件末尾的函数是______。
填空题阅读下面程序,则程序的执行结果为 【16】 。 #include"stdio.h" fun(int k,int*p) int a,b; if(k==1‖k==2) *p=1; else fun(k-1,&a); fun(k-2,&b); *p=a+b; main() int x; fun(6,&x); printf("%d/n",x);
填空题若有定义int m=5,y=2,则执行表达式y+=y-=m*=y后,y的值为______。
填空题以下程序的运行结果是 {{U}} 【19】 {{/U}}
#include <string.h>
typedef struct student{
char name[10];
long sno;
float score; }STU;
main( )
{ STU a={“zhangsan”,2001,95},b={“Shangxian”,2002,90},
c={“Anhua”,2003,95},d,*p=
d=a;
if(strcmp(a.name,b.name)>0) d=b;
if(strcmp(c.name,d.name)>0) d=c;
printf(“%ld%s/n”,d.sno,p->name);
填空题下面程序的运行结果是 【10】 。 main() int i=0,j=10,k=2,s=0; for(;;) i+=k; if(i>j) printf("%d/n",s); break; s+=i;
填空题请补充main()函数,该函数的功能是:打印出1~10000中满足个位数字的立方等于其本身的所有数。 本题的结果为:1 64 125 216 729 注意:部分源程序已给出。 请勿改动主函数main和其他函数中的任何内容。 试题程序: #include<stdlib.h> #include<stdio.h> void main() int i, k; system("CLS"); for(i=1; i<10000; i++) k= (1) ; if( (2) ) printf("%4d", i);
填空题以下程序的运行结果是______。 struct Node int x; char ch; ; fun(struct Node*sn) static k=1; sn->x=20; Sn->ch='a'+k++; main() int i; static struct Node st=10,'a'; for(i=0;i<2;i++) fun(&st); printf("%d,%c/n",st.x,st.ch);
填空题下列给定程序中,函数proc()的功能是:根据整型形参n的值,计算如下公式的值。 t=1-1/(2×2)-1/(3×3)-…-1/(n×n) 例如,当n=7时,t=0.488203。 请修改函数proc()中的错误,使它能得出正确的结果。 注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include<stdlib.h> #include<conio.h> #include<stdio.h> double proc(int n) double y=1.0; int i; //************found************* for(i=2; i<n; i++) //************found************* y-=1/(i*i); return(y); void main() int n=7; system("CLS"); printf("/nThe result is %1f/n", proc(n));
填空题一个类可以从直接或间接的祖先中继承所有属性和方法。采用这个方法提高了软件的{{U}} 【3】 {{/U}}。
填空题下列程序可以判断输入的年份是不是闰年。 #include main() int 【11】 ,leap; scanf("%d", if(year%4) leap=0; else if(year%lO0) 【12】 ; else if(year%400) leap=0; else leap=1; if( 【13】 ) printf("%d年是闰年",year); else printf (" %d年不是闰年/n", year);
填空题有一个已排好序的数组,今输入一个数,要求按原来的顺序规律将它插入到数组中。算法是:假设排序顺序是从小到大,对输入的数,检查它在数组中哪个数之后,然后将比这个数大的数顺序后移一个位置,在空出的位置上将该数插入。请在程序中的空白处填上一条语句或一个表达式。 #define N 100 main() float a[N+1],x; int i,p; for(i=0;i<N;i++) scanf("%f', for(i=0,p=N;i<N;i++) if(x<a[i]) 【18】 ; for(i=N-1; 【19】 ;i-) a[i+1]=a[i]; a[p]=x; for(i=0; 【20】 ;i++) printf("%8.2f',a[i]); if(i%5==0) printf("/n");
填空题买来一张新盘后,在存入文件前,必须进行______处理。
