填空题请补充函数proc(),该函数的功能是:只保留字符串中的大写字母,删除其他字符,结果仍保存在原来的字符串中,由全局变量m对删除后字符串的长度进行保存。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdlib.h>
#include<stdlib.h>
#include<conio.h>
int m;
void proc(char*str)
{
int i=0, j=0;
char*p=str;
while(*(p+i))
{
if(*(p+i)>="A"
}
______;
}
str[j]="/0";
______;
}
void main()
{
char str[80];
system("CLS");
printf("/nEnter a string: ");
gets(str);
printf("/n/nThe string is: %s/n", str);
proc(str);
printf("/n/nThe string of changing is: %s/n", str);
printf("/n/nThe length of changed string is: %d/n", m);
}
填空题表达式1/2*(int)3.7/(int)(2.4*(1.5+2.5))值的数据类型为______。
填空题函数pi的功能是根据以下近似公式求π值: (π*π)/6=1+1/(2*2)+1/(3*3)+…+1/(n*n) 现在请你在下面的函数中填空,完成求丌的功能。 #include<math.h> double pi(10ng n) double s=0.0; long i; for(i=1; i<=n; i++)s=s+______; return(sqrt(6*s));
填空题在C语言中,当表达式值为0时表示逻辑值“假”,当表达式值为 (8) 时表示逻辑值“真”。
填空题有以下程序
#include
main()
{ int a[]={1,2,3,4,5,6},*k[3],i=0;
while(i<3)
{ k[i]=
printf("%d",*k[i]);
i++;
}
}
程序运行后的输出结果是 【 】 。
填空题若有以下定义:
int a[8];
则a数组元素的下标上限为______,下限为______。
填空题下列给定程序中函数fun()的功能是:将长整型数中各位上为奇数的数依次取出,构成一个新数放在t中。高位仍在高位,低位仍在低位。
例如,当s中的数为87653142时,t中的数为7531。 请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。
试题程序 #include
<stdlib.h> #include <stdio.h> #include
<conio.h> void fun(long s, long * t) { int
d; long s1=1; *t=0;
while(s>0) { d=s% 10; if(d% 2!=0)或if(d%
2==1) { *t=d*s1+*t; s1 *=10;
} s/=10; } }
void main() { long s, t; printf("/nPlease
enter s:"); /* * * * *found* * * * * /
______ fun(s, printf("The result is:%
ld/n", t); }
填空题请补充函数fun(),该函数的功能是:计算下面公式的值(k<50):例如:当k=5时,s=338.215158。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数函数fun()的横线上填入所编写的若干表达式或语句。试题程序:#include<conio.h>#include<stdio.h>doublefun(intn){doubles={{U}}【1】{{/U}};doublef=0.0;doublep=0.0;inti=0;intk;for(k=1;{{U}}【2】{{/U}};k++){f=2*k-1;p=2*k+l;for(i=1;i<2*k+l;i++)f*=2*k-1;for(i=1;i<2*k-1;i++)p*=2*k+1;{{U}}【3】{{/U}};}returns;}main(){intk=0;doubles;clrscr();printf("/nPleaseinputk(k<50):");scanf("%d",&k);s=fun(k);printf("/nS=%lf",s);}
填空题x和y都是double型变量,x的初值为4.0,y的初值为2.0,则表达式pow(y,fabs(x))的值为______。
填空题有以下程序
#include
#include
void fun(char *str)
{ char temp;int n,i;
n=strlen(str);
temp=str[n-1];
for(i=n-1;i>0;i--) str[i]=str[i-1];
str[0]=temp;
}
main()
{ char s[50];
scanf("%s",s); fun(s); printf("%s/n",s);}
程序运行后输入:abcdef,则输出结果是 【 】 。
填空题函数fun的功能是:计算,直到<10-6。若x=2.5,函数值为12.182494。请在程序的下划线处填入正确的内容,使程序得出正确的结果。注意:部分源程序给出如下。不得增行或删行,也不得更改程序的结构。试题程序:#include<stdio.h>#include<math.h>doublefun(doublex){doublef,t;intn;/**********found**********/f=1.0+________;t=x;n=1;do{n++;/**********found**********/t*=x/________;/**********found**********/f+=________;}while(fabs(t)>=1e-6);returnf;}main(){doublex,y;x=2.5;y=fun(x);printf("/nTheresultis:/n");printf("x=%-12.6fy=%-12.6f/n",x,y);}
填空题以下程序运行后的输出结果是______。
main()
{ int p[7]={11,13,14,15,16,17,18};
int i=0,j=0;
while(i<7&&p[i]%2==1) j+=p[i++];
printf("%d/n",j);
}
填空题mystrlen函数的功能是计算str所指字符串的长度,并作为函数值返回。请填空。 int mystrlen(char*str) int I; for(I=0; ______!='/n'; I++); return(I);
填空题根据以下if语句写出与其功能相同的switch语句(x的值在0~100之间)。 if语句: if(x<60)m=1; else if(x<70)m=2; else if(x<80)m=3; else if(x<90)m=4; else if(x<100)m=5; switch语句: switch( 【8】 ) 【9】 m=1;break; case 6:m=2;break; case 7:m=3;break; case 8:m=4;break; 【10】 m=5;
填空题软件危机出现于20时纪60年代末,为了解决软件危机,人们提出了______的原理来设计软件,这就是软件工程诞生的基础。
填空题下列程序的运行结果是{{U}} 【16】 {{/U}}。
main()
{ union EXAMPLE
{ struct
{ int x;int y;}in;
int a;
int b;
} e:
e.a=1;e.b=2;
e.in.x=e.a*e.b;
e.in.y=e.a+e.b;
printf("%d,%d/n",e.in.x,e.in.y);
}
填空题下列程序的输出结果是{{U}} 【6】 {{/U}}。
main()
{
int a=1,b=2;
a=a+b;b=a-b;a=a-b;
prrintf("%d,%d/n",a,b) ;
}
填空题若要说明一个新类型名ArrInt,使得定义语句ArrInt x;等价于定义语句Int x[4][10];,正确的说明语句形式为{{U}} 【8】 {{/U}}。
填空题下列程序的运行结果是 【17】 。 main() int i; for(i=1;i<=5;i++) f(i); f(j) int j; static int a=1000; auto int k=1; ++k; printf("%d+%d+%d=%d/n",a,k,j,a+k+j); a+=10;
填空题以下sstrcpy()函数实现字符串复制,即将t所指字符串复制到s所指向内存空间中,形成一个新的字符串s。清填空。 void sstrcpy(char *s,char *t) while(*s++= 【15】 ); main() char str1[100],str2[]="abcdefgh"; strcpy(str1,str2); printf('%s/n",str1);
