填空题下列语句能循环______次。 int s=12; while(s); --S;
填空题以下程序运行后的输出结果是 【15】 。 main() char a[]="Language",b[]"Programe"; char * p1,*p2; int k; p1=a,p2=b; for(k=0;k<=7;k++) if(*(p1+k==*(p2+k))printf("%c",*(p1+k));
填空题下列给定程序中,函数fun()的功能是;计算函数 F(x, y ,z)=(x+ y)/(x-y)+(z+ y)/(z-y)的值。其中x和y不相等,z和y不等。例如,当x的值为9,y的值为11,2的值为15时,函数值为-3.50。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main 函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include <stdio. h> #include <math. h> /**************found******************/ #define FU(m, n) (m/n) float fun(float a, float b, float c) float value; value=FU(a+ b, a-b)+FU(c+ b, c-b); /*************found******************/ return(Value); main() float x, y, z, sum; printf ("Input x y z:: "); scanf("%f%f%f", printf("x=%f, y=%f, z=%f/n ",x, y, z); if (x==y||y==z) printf ("Data error! /n "); exit (0); sum=fun (x, y, z); printf("The result is:%5. 2f/n ",sum);
填空题以下sum函数的功能是计算下列级数之和。 请给函数中的各变量正确赋初值。 double sum(doublex,intn) { int i; double a,b,s; {{U}} 【20】 {{/U}} for(i=1;i<=n;i++) { a=a*x; b=b*i; s=s+a/b;} return s;}
填空题阅读下列程序,则程序的输出结果为______。 #include"stdio.h" struct ty int data; char c;; main() struct ty a=30,'x'; fun(a); printf("%d%c",a.data,a.c); fun(struct ty b) b.data=20; b.c='y';
填空题在对文件进行操作的过程中,若要使文件位置的指针回到文件的开头,应使用的函数是{{U}} {{U}} {{/U}} {{/U}}。
填空题将以下程序段写成三目运算表达式: 【11】 。 if(a>b) max=a; else max=b;
填空题定义int a=5,b=20;若执行语句printf("%d/n",++a*--b/5%13);后,输出的结果为______。
填空题下面的函数strcat(str1,str2)实现将字符串str2拼接到字符串str1后面的功能。请填空使之完整。
char*strcat(str1,str2)
char*str1,*str2;
{ char*t=str1;
while({{U}} 【16】 {{/U}})str1++;
while({{U}} 【17】 {{/U}});
return(t);}
填空题以下程序中函数huiwen.的功能是检查一个字符串是否是回文,当字符串是回文时,函数返回字符串: yes!,否则函数返回字符串:no!,并在主函数中输出,所谓回文即正向与反向的拼写都一样,例如:adgda。请填空。 #include<string.h> char *huiwen(char*str) char*p1,*P2;int i,t=0; P1=str;p2= 【18】 ; for(i=0;i<=strlen(str)/2;i++) if(*p1++!=*p2--)t=1;break; if( 【19】 )return("yes!"); else return("no!"); main() char str[50]; printf("Input:");scanf("%s",str); printf("%s/n", 【20】 );
填空题以下程序的运行结果是 【19】 。 #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("%1d%s/n",d.sno,p->name);
填空题有以下程序: main() int t=1,i=5; for(;i>=0;i--)t*=i; printf("%d/n",c); 执行后输出结果是______。
填空题以下程序是建立一个名为myfile的文件,并把从键盘输入的字符存入该文件,当键盘上输入结束时关闭该文件。
#include
main()
{ FILE *fp;
char c;
fp=__________ ;
do{
c=getchar();
fputs(c,fp);
}while(c!=EOF);
__________ }
填空题以下程序的定义语句中,X[1]的初值是 10 ,程序运行后输出的内容是 11 。 #include main() int X[]=(1,2,3,4,5,6,7,8,9,10.11,12,13,14,15,16),*p[4]i; for(i=0(i<4;i++) (p[i]=&X[2*i+1]; printf(“%d”,p[i][0]); printf(“/n”);
填空题strcat函数的作用是{{U}} {{/U}}。
填空题若输入字符串:abcde↓,则以下while循环体将执行 【12】 次。 while((ch=getchar())=='e')printf("*");
填空题下列给定函数中,函数fun()的功能是:统计字符串中各元音字母(即A,E,I,O,U)的个数。注意:字母不分大小写。例如,输入THIs is a boot,则应输出是1 0 2 2 0。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include <conio.h> #include <stdio.h> /*************found**************/ fun(char *s, int num[5]) int k, i=5; for(k=0;k<i;k++) /*************found**************/ num [i]=0; for(;*s;s++) i=-l; /*************found**************/ switch(s) case 'a': case 'A':i=0;break; case 'e': case 'E':i=1;break; case 'i': case 'I':i=2;break; case 'o': case 'O':i=3;break; case 'u': case 'U':i=4;break; if(i>=0) num[i]++; main ( ) char s1[81]; int num1[5], i; clrscr (); printf("/nPlease enter a string: "); gets (s1); fun(s1, num1); for(i=0;i<5;i++) printf("%d",num1[i]); printf ("/n");
填空题若有以下程序:
main()
{ int,p,a=5;
if(P=a!=0)
printf("%d/n",p);
else
printf("%d/n",p+2);
}
执行后输出结果是{{U}} 【8】 {{/U}}。
填空题以下程序用来输出结构体变量ex所占存储单元的字节数: struct st char name[20];double score;; main() struct st ex; printf("ex size:%d/n",sizeof( 【14】 ));
填空题数据模型按不同的应用层次分为三种类型,它们是 【5】 数据模型、逻辑数据模型和物理数据模型。
