填空题若用0至9之间不同的三个数构成一个三位数,下面程序将统计出共有多少种方法。请填空。 #include<stdio.h> main() int i,j,k,count=0; for(i=0;i<=9;i++) for(j=0;i<=9;j++) if(______)continue; else for(k=0;k<=9;k++) if(______)count++; printf("%d",count);
填空题在进行模块测试时,要为每个被测试的模块另外设计两类模块:驱动模块和承接模块(桩模块)。其中 【4】 的作用是将测试数据传送给被测试的模块,并显示被测试模块所产生的结果。
填空题有以下程序: #include<stdio.h> main() int a[3][3]=1, 2, 3, 4, 5, 6, 7, 8, 9; int b[3]=0, i; for(i=0; i<3; i++) b[i]=a[i][2]+a[2][i]; for(i=0; i<3; i++) printf("%d", b[i]); printf("/n"); 程序运行后的输出结果是______。
填空题以下程序运行后的输出结果是{{U}} 【20】 {{/U}}。
#include <stdio.h>
fun(int x)
{ if(x/2>0) fun(x/2);
printf("%d",x);
}
main()
{ fun(6); }
填空题请补充main 函数,该函数的功能是:先以只写方式打开文件“out99.dat”,再把字符串str中的字符保存到这个磁盘文件中。
注意:部分源程序给出如下。
请勿改动主函数main 和其他函数中的任何内容,仅在 main 函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include "stdio. h"
#include "conio.h"
#define N 80
main ()
{
FILE *fp;
int i=0;
char ch;
char str[N]="I'm a student!";
clrscr();
if ( (fp=fopen ({{U}} 【1】 {{/U}}) ) ==NULL)
{
printf("cannot open out99. dat/n");
exit(0);
}
while (str[i])
{
ch=str[i];
{{U}}【2】 {{/U}};
putchar(ch);
i++;
}
{{U}} 【3】 {{/U}};
}
填空题软件的调试方法主要有:强行排错法、______和原因排除法。
填空题在数据库技术中,实体集之间的联系可以是一对一、一对多或多对多的,那么“学生”和“可选课程”的联系为______。
填空题下面程序由两个源程序文件:t4.h和t4.c组成,程序编译运行的结果是:【 】。
t4.h的源程序为:
#define N 10
#define f2(x) (X*N)
t4.c的源程序为:
#include
#define M 8
#define f(x) ((x)*M)
#include "t4.h"
main()
{int i,j;
i=f(1+1);j=t2(1+1);
printf("%d%d\n",i,J);
}
填空题在VC6.0环境中用RUN命令运行一个C程序时,这时所运行的程序的后缀是______。
填空题已知一个数列从0项开始的前3项:0,0,1,以后的各项都是其相邻的前3项之和。下列给定的程序中,函数fun()的功能是:计算并输出该数列前n项的和sum。n的值通过形参传入。例如,当n=10时,程序的输出结果应为96.000000。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <conio.h>
#include <stdio.h>
double fun(int n)
{
double sum,s0,s1,s2,s;
int k;
sum=1.0;
if (n<=2)
sum=0.0;
s0=0.0;
s1=0.0;
s2=1.0;
/*************found*************/
for (k=4;k<n;k++)
{
s=s0+s1+s2;
sum+=s;
s0=s1;
s1=s2;
/*************found*************/
s2=s;
return sum;
}
main()
{
int n;
clrscr();
printf("Input N=");
scanf("%d",&n);
printf("%f/n",fun(n));
}
填空题给定程序中函数fun的功能是:根据以下公式求π值,并作为函数值返回。例如,给指定精度的变量eps输入0.0005时,应当输出Pi=3.140578。请改正程序中的错误,使它能得出正确结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。给定源程序:#include<math.h>#include<stdio.h>doublefun(doubleeps){doubles,t;intn=1;s=0.0;/************found************/t=0;while(t>eps){s+=t;t=t*n/(2*n+1);n++;}/************found************/return(s);}main(){doublex;printf("/nPleaseenteraprecision:");scanf("%lf",printf("/neps=%lf,Pi=%lf/n/n",x,fun(x));}
填空题若从键盘输入58,则以下程序输出的结果是 【6】 。 mam() int a; scanf("%d", if(a>50) printf("%d",a); if(a>40) printf("%d",a); if(a>30) printf("%d",a);
填空题按“先进后出”原则组织数据的数据结构是______。
填空题下面的if语句与y=(x>=10)?3*x-11:(x<1)?x:2*x-1;的功能相同,请补充完整。 if(______) if(______)y=2*x-1; else y=x; else y=3*x-11;
填空题下列程序中的函数strcpy2 ()实现字符串两次复制,即将t所指字符串复制两次到s 所指内存空间中,合并形成一个新字符串。例如,若t所指字符串为:efgh,调用strcpy2后,s所指字符串为: efghefgh。请填空。 #include <stdio.h> #include <string.h> viod strcpy2(char *s,char *t) char while (*s++=t++); s=______: while(______=*p++); main() char str1[100]="abcd", str2[]="efgh"; strcpy2 (str1,str2); printf("%s/n",str1);
填空题下列程序段的输出结果是______。 int n='c'; switch(n++) default: printf("error"); break; case'a': case'A': case'b': case'B': printf("good"); break; case'c': case'c': printf("pass"); case'd': case'D': printf("warn");
填空题以下程序用以删除字符串所有的空格,请填空。
#include
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];j++;}
s[j]= 【 】
printf(“%s/n”,s);
}
填空题strcat函数的作用是{{U}} 【10】 {{/U}}。
填空题下面程序的输出结果是 【16】 。 #include<stdio.h> main() static char a[]="language" ,b[]="program"; char*ptrl=a,*ptr2=b; int k; for(k=0;k<7;k++) if(*(ptrl+k)==*(ptr2+k)) printf("%c",*(ptrl+k));
填空题请补充main()函数,该函数的功能是:从键盘输入学生的成绩(用Enter键作为分隔符),并统计各分数段学生的人数。具体要求为:A类为90~100分,B类为80~89分,C类为70~79分,D类为60~69分,59分以下的为E类。当成绩为0时结束成绩的输入,并且最后输入的0不进行统计。
例如,若输入:89,99,45,90,56,78,88,74,66,55,0,则显示结果为:A:2 B:2 C:2 D:1 E:3。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在main()函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#define M 100
void main()
{
float score[M];
int bb[5];
int grade, i=-1, n=0;
char ch="A";
system("CLS");
printf("Input a score(0~100); /n");
do
{
i++;
n++;
printf("score[%d]=", i);
scanf(______);
}while(score[i]!=0);
for(i=0; i<5; i++)
______;
for(i=0; i<n-1; i++)
{
grade=______;
switch(grade)
{ case 10:
case 9: bb[0]++; break;
case 8: bb[1]++; break;
case 7: bb[2]++; break;
case 6: bb[3]++; break;
default: bb[4]++;
}
}
for(i=0; i<5; i++)
printf("/n%c: %d", ch+i, bb[i]);
}
