填空题有如下程序段: main(int argc,char *argv[]) int n,i=0; while(argv[1][i]!='/0') n=fun();i++; printf("%d/n",n*argc); int fun() static int s=0; s+=1; return s; 假设程序经编译、连接后生成可执行文件exam,exe,若键入如下命令行: exam l23<回车> 则运行结果为 【11】 。
填空题有以下程序: #define N 20 fun(int a[],int n,int m) inf i,j; for(i=m;i>n;i--)a[i+1]=a[i]; main() int i,a[N]=(1,2,3,4,5,6,7,8,9,10); fun(a,2,9); for(i=0;i<5;i++)printf(“%d”,a[i]); 程序运行后的输出结果是______。
填空题有以下程序:
fun(int a,int b)
{ if(a>b)return(a);
else return(b);
}
main()
{ int x=3,y=8,z=6,r;
r=fun(fun(x,y),2*z);
printf("%/d/n",r);
}
程序运行后的输出的结果是{{U}} 【7】 {{/U}}。
填空题若从键盘输入58,则以下程序输出的结果是______。 main ) int a; scanf ("%d" , if (a>50) print f ("%d" ,a); if (a>40) print f ("%d" ,a); if (a>30) printf ("%d" ,a);
填空题以下程序运行后的输出结果是______。
main()
{ int i,n[]={0,0,0,0};
for(i=1;i<=3;i++)
{n[i]=n[i-1]*3+2;
printf("%d",n[i]);
}
}
填空题在DOS环境下,表示打印机的设备文件名是【 】。
填空题数据库技术的主要特点为数据的集成性、数据的高{{U}} 【4】 {{/U}}和低冗余性、数据独立性和数据统—管理与控制。
填空题给定程序中,函数fun的功能是计算下式直到,并把计算结果作为函数值返回。例如:若形参e的值为1e-3,函数的返回值为0.551690。请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。注意:源程序存放在下的BLANK1.C中。不得增行或删行,也不得更改程序的结构!给定源程序:#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=1e-3;printf("/nTheresultis:%f/n",fun(e));}
填空题下列给定程序中,函数fun的功能是:将s所指字符串中位于奇数位置的字符或ASCII码值为偶数的字符依次放入t所指数组中。例如,字符串中的数据为“AABBCCDDEEFF”,则输出应当是“ABBCDDEFF”。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<conio.h>
#include<stdio.h>
#include<string.h>
#define N 80
void fun(char*s,char t[])
{
int i,j=0;
for(i=0;i<(int)strlen(s);i++)
/*********found*********/
if(i%2
/*********found*********/
t[i]="/0";
}
main()
{
char s[N],t[N];
printf("/nPlease enther string s:");
gets(s);
fun(s,t);
printf("/nThe result is:%s/n",t);
}
填空题下面函数的功能是将一个字符串的内容颠倒过来,请填空。 void fun(char str[]) int i,j,k; for(i=0,j= 【15】 ;i<j;i++,j--) k=str[i]; str[i]=str[j]; str[j]=k;
填空题已知字符A的ASCII代码值为65,以下程序运行时若从键盘输入:B33<回车>,则输出结果是 【6】 。 # include main() char a, b; a=getchar(); scanf("% d", a=a-'A'+'0'; b=b*2; printf("% c % c/n", a, b);
填空题以下程序运行后的输出结果是______。 mein() int a=3,b=4,c=5,t=99; if(b<a&&a<c)t=a;a=c;c=t; if(a<c&&b<c)t=b;b=a;a=t; printf("%d%d%d/n",a,b,c);
填空题以下程序中函数huiwen的功能是检查一个字符串是否是回文,当字符串是回文时,函数返回字符串“yes!”,否则函数返回字符串“no!”,并在主函数中输出。所谓回文即正向与反向的拼写都一样,例如:adsda。请填空。 #include <stdio, h>#include <string, h>char * huiwen(char * str) char *p1, * p2; int i,t=0; p1 = str;p2 = 【10】 ; for(i =0;i<= strlen(str)/2;i ++ ) if( * pl ++ ! = * p2 -- ) t = 1 ;break if( 【11】 ) return( "yes !" ); else return( "no!" );main( ) char str[50]; printf( "Iaput:" ); scanf(" % s", str); printf("%s /n", 【12】 );
填空题下列程序中函数fun的功能是:统计person所指结构体数组中所有性别(sex)为M的记录的个数,存入变量n中,并作为函数值返回。请填空。
#include <stdio.h>
#define N 3
typedef struct
{ int num; char nam[10]; char sex;} SS;
int fun(SS person[])
{ int i,n=0;
for(i=0; i<N; i++)
if( 【 】 ==''M'') n++;
return n;
}
main()
{ SS W[N]={{1,"AA",''F''},{2,"BB",''M''},{3,"CC",''M''}}; int n;
n=fun(W); printf("n=%d\n", n);
}
填空题下列给定程序中函数fun的功能是:将长整型数中各位上为偶数的数依次取出,构成一个新数放在t中。高位仍在高位,低位仍在低位。
例如,当s中的数为87653142时,t中的数为8642。
请改正程序中的错误,使它能得出正确的结果。
注意
:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include <conio.h>
#include <stdio.h>
void fun(long s,long *t)
{
int d;
long s1=1;
*t=0;
while(s>0)
{
d=s%10;
/********found********/
if(d%2=0)
{
*t=d,s1+*t;
s1*=10;
}
/********found********/
s/=10;
}
}
main()
{
long s,t;
printf("/nPlease enter s:");
scanf("%ld",
fun(s,
printf("The result is:%ld/n",t);
}
填空题以下程序运行后的输出结果是 【13】 。 void swap(int x,int y) int t; t=x;x=Y;Y=t;printf("%d%d",x,y); main() int a=3,b=4; swap(a,b);printf("%d%d",a,b);
填空题数据库系统的三级模式分别为 【4】 模式、内部级模式与外部级模拭。
填空题以下程序的输出结果是{{U}} 【9】 {{/U}}。
#include <stdio.h>
main()
{ int n=12345,d;
while(n!=0){ d=n%10; printf("%d",D) ; n/=10; }
}
填空题请补充main 函数,该函数的功能是:把文本文件B中的内容追加到文本文件A的内容之后。
例如,文佃的内容为“I’m ten.”,文件A的内容为“I’ m a student!”,追加之后文件A的内容为“I’m a student !I’m ten.”
注意:部分源程序给出如下。
请勿改动主函数main 和其他函数中的任何内容,仅在函数main 的横线上填入所编写的若干表达式或语句。
试题程序:
# include<stdio, h>
#include<conio. h>
#define N 80
main()
{
FILE *fp, * fp1, *fp2;
int i;
char c[N] ,t, ch;
clrscr ();
if ((fp=fopen ("A. dat ", "r") ) == NULL)
{
printf ("file A cannot be opened/n");
exit (0);
}
printf("/n A contents are : /n/n");
for (i=0; (ch=fgetc (fp)) !=EOF; i++)
{
C [i]=ch;
putchar (c [i]);
fclose (fp);
if((fp=fopen ("B. dat", "r") )==NULL)
{
printf ("file B cannot be opened/n");
exit (0);
}
printf("/n/n/nB contents are : /n/n");
for (i=0; (ch=fgetc (fp)) !=EOF; i++)
{
c [i] =ch;
putchar (c [i]);
}
fclose (fp);
if ( (fp1=fopen ("A.dat" ,"a")){{U}} 【1】 {{/U}}(fp2
=fopen ("B. dat", "r") ) )
{
while ( (ch=fgetc (fp2)) !=EOF)
{{U}} 【2】 {{/U}};
}
else
{
printf("Can not open A B !/n");
}
fclose (fp2);
fclose (fp1);
printf ("/n***new A contents***/n/n");
if ( ( fp=fopen ("A. dar", "r") )==NULL)
{
printf ("file A cannot be opened/n");
exit (0);
}
for (i=0; (ch=fgetc (fp)) !=EOF;i++)
{
c [i] =ch;
putchar (c [i] );
}
{{U}}【3】 {{/U}};
}
填空题以下程序的输出结果是______。
#include<stdio.h>
main()
{ char*p="abcdefg",*r;
long*q;
q=(long*)p;
q++;
r=(char*)q;
printf("%s/n",r);
}
