填空题以下程序用于判断a、b、c能否构成三角形,若能,输出YES,否则输出NO。当给a、b、c输入三角形三条边长时,确定a、b、c能构成三角形的条件是需同时满足三个条件:a+b>c,a+c>b,b+c>a。 请填空。 main() float a,b,c; scanf("%f%f%f", if( 【7】 ) printf("YES/n"); /*a、b、c能构成三角形*/ else printf("NO/n"); /*a、b、c不能构成三角形*/
填空题下面程序的运行结果是______。
#define DOUBLE(r)r*r
main()
{ int x=4,y=2,t;
t=DOUBLE(x+y);
printf("%d",t);
}
填空题下列给定程序中,函数fun的功能是:计算如下公式直到,并且把计算结果作为函数值返回。例如,若形参e的值为le-3,则函数返回值为0.551690。请在下画线处填入正确的内容并将下画线删除,使程序得出正确的结果。注意:部分源程序给出如下。不得增行或删行,也不得更改程序的结构!试题程序:#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=le-3;printf("/nTheresultis:%f/n",fun(e));}
填空题以下程序运行后输出结果是{{U}} {{U}} {{/U}} {{/U}}。
#include <stdio, h>
main( )
{ int a,b,c;
a=10; b:20; c=(a%b<1) ‖ (a/b>1);
printf("%d %d %d/n",a,b,c);
}
填空题以下程序运行后的输出结果是______。
#include<stdio.h>
main()
{ int a;
a=(int)((double)(3/2)+0.5+(int)1.99*2);
printf("%d/n", a);
}
填空题在算法正确的前提下,评价一个算法的两个标准是 【1】 。
填空题请补充main()函数,该函数的功能是求方程qx
2
+px+j=0的两个实数根。方程的系数q、p、j从键盘输入,如果判别式(disc=p
2
-4qj)小于0,则要求重新输入q、p、j的值。
例如,当q=1,p=-2,j=1时,方程的两个根分别是x1=1.00,x2=1.00。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在横线上填入所编写的若干表达式或语句。
试题程序:
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
void main()
{
float q, p, j, disc, x1, x2;
system("CLS");
do
{
printf("Input q, p, j:");
scanf("%f, %f, %f",
disc=p*p-4*q*j;
if(disc<0)
printf("disc=%f/n Input again!/n", disc);
}
while(______);
printf("****the result****/n");
x1=______;
x2=______;
printf("/nx1=%6.2f/nx2=%6.2f/n", x1, x2);
}
填空题下面rotate函数的功能是:将n行n列的矩阵A转置A',例如当请填空。#defineN4voidrotate(inta[][N])inti,j,t;for(i=0;i<N;i++)for(j=0;______;j++)t=a[i][j];______;a[j][i]=t;
填空题下列给定程序中,函数fun的功能是:计算s所指字符串中含有t所指字符串的数目,并作为函数值返回。
请改正程序中的错误或在下划线处填上正确的内容并把下划线删除,使它能得出正确的结果。
注意
:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<conio.h>
#include<stdio.h>
#include<string.h>
#define N 80
int fun(char *s,char *t)
{
int n;
char *p,*r;
n=0;
p=
/********found********/
*r=t;
while(*p)
{
if(*r==*p)
{
r++;
if{*r="/0")
{
n++;
/********found********/
______
}
}
p++;
}
return n;
}
void main()
{
char a[N],b[N];
int m;
printf("/nPlease enter string a:");
gets(a);
printf("/nPlease enter substring b:");
gets(b);
m=fun(a,b);
printf("/nThe result is:m=%d/n",m);
}
填空题关系模型的数据操作即是建立在关系上的数据操作,一般有 【2】 、增加、删除和修改四种操作。
填空题以下程序的功能是计算:s=1+12+123+1234+12345。请填空。 main() int t=0,s=0,i; for(i=1;i<=5;i++) t=i+ 【1】 ;s=s+t; printf("s=%d/n",s);
填空题有以下程序
main( )
{ int n=0,m=1,x=2;
if(!n) x-=1;
if(m) x-=2;
if(x) x-=3;
printf(“%d\n”,x);}
执行后输出结果是【 】。
填空题下列给定程序的功能是:读入一个整数n(2<=n<=5000),打印它的所有为素数的因子。例如,若输入整数1234,则应输出2,617。
请修改程序中的错误,使程序能得出正确的结果。
注意:不要改动main()函数,不能增选或删行,也不能更改程序的结构。
试题程序:
#include<conio.h>
#include<stdio.h>
//****found****
Prime(int m);
{
int j,p;
p=1;
//****found****
for(j=2;j<m;j++)
if!(m%j)
{
p=0;
break;
}
return(p);
}
main()
{
int i,n;
printf("/nplease enter an integer number between 2
and 5000:");
scanf("%d",
printf("/n/nThe prime factor(s)of%d is(are):",
n);
for(i=2;i<n;i++)
if((!(n%i))
printf("/n");
}
填空题以下程序运行后的输出结果是______。 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);
填空题若有定义语句char s[100],d[100];int j=0,i=0;且s中已赋字符串,请填空以实现拷贝。(注:不使用逗号表达式) while(s[i])d[j]= 【15】 ;j++; d[j]=0;
填空题请补充main函数,该函数的功能是:从键盘输入一个字符串及一个指定字符,然后把这个字符及其后面的所有字符全部删除。结果仍然保存在原串中。 例如,输入“abcdef”,指定字符为‘e’,则输出“abcd”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。 试题程序: #include <stdio. h> #define N 80 main () int i=0; char str [N]; char ch; clrscr (); printf"/n Input a string:/n"); gets (str); printf("kn Input a charator;/n"); scanf ("%c", while (str [i] !='/0') if (str [i]==ch) 【1】 【2】 ; str[i]= 【3】 ; printf"/n*** display string ***/n"); puts (str);
填空题用十六进制给存储器中的字节地址进行编号,若地址编号从0000到FFFF,则该存储器的容量为{{U}} 【1】 {{/U}}KB。
填空题以下程序运行后的输出结果是______。 main() int a, b, c; a=25; b=025; C=0x25 printf("%d%d%d/n", a, b, c);
填空题有以下程序,程序执行后,输出结果是{{U}} 【11】 {{/U}}
#include<stdio.h>
void fun(int*A)
{ a[0]=a[1];}
main()
{ int a[10]={10,9,8,7,6,5,4,3,2,1,},i;
for(i=2;i>1=0;i-) fun(
for(i=0;i<10;i++) printf("%d,a[i]);
printf("/n");
}
填空题函数mycmp(char*s,char*t)的功能提比较字符串s和t的大小,当s等于t时返回0,当s>t返回正值,当s<t时返回负值。请填空。 mycmp(char*s,char*t) while(*s==*t) if(*s=='/0')return0; ++s;++t; return( 【14】 )
