(完整word版)C语言填空题整理.pdfVIP

  • 0
  • 0
  • 约1.09万字
  • 约 15页
  • 2026-03-03 发布于青海
  • 举报

一.(25)

116、以下程序运行后的输出结果是__3____。

main()

{intp=30;

printf(%d\n,(p/30?p/10:p%3));

}

66、若想通过以下输入语句使a=5.0,b=4,c=3,则输入数据的形式应该是__5.0,4,c=3____。

intb,c;floata;

scanf(%f,%d,c=%d,a,b,c)

27、请在以下程序第一行的下划线处填写适当内容,使程序能正常运行。

_doublemax或externdoublemax_____(double,double);

main()

{doublex,y;

scanf(%1f%1f,x,y);

printf(%1f\n,max(x,y));

}

doublemax(doublea,doubleb)

{return(ab?a:b);}

57、以下程序的输出结果是__246____。

voidfun()

{

staticinta=0;

a+=2;

printf(%d,a);

}

main()

{

intcc;

for(cc=1;cc4;cc++)fun();

printf(\n);

}

43、以下程序运行后的输出结果是_81_____。

#defineS(x)4*x*x+1

main()

{inti=6,j=8;

printf(%d\n,S(i+j));

}

73、以下函数inverse的功能是使一个字符串按逆序存放。

inverse(str)

charstr[];

{

charm;

inti,j;

for(i=0,j=strlen(str);istrlen(str)/2;_i++_____,j--)

{

m=str[i];

str[i]=_str[j-1]_____;

_str[j-1]=m_____;

}

}

144、以下程序的输出结果_efgh_____。

#includestdio.h

#includestring.h

char*fun(char*t)

{char*p=t;

return(p+strlen(t)/2);

}

main()

{char*str=abcdefgh;

str=fun(str);

puts(str);

}

67、下列程序的输出结果是__56____。

intt(intx,inty,intcp,intdp)

{cp=x*x+y*y;

dp=x*x-y*y;

}

main()

{inta=4,b=3,c=5,d=6;

t(a,b,c,d);

printf(%d%d\n,c,d);

}

19、若有如下结构体说明:

structSTRU

{inta,b;charc:doubled;

structSTRU*p1,*p2;

};

请填空,以完成对t数组的定义,t数组的每个元素为该结构体类型。

__structSTRU____t[20]

100、以下程序用来统计文件字符的个数,请填空。

#includestdio.h

main()

{FILE*fp;longnum=O;

if((fp=fopen(fname.dat,r))==NULL)

{PRINTF(Openerror\n);exit(0);}

while(__fgetc(fp)!=EOF或!feof(fp)____)

{num++;}

printf(num=%ld\n,num);

fclose(fp);

}

93、以下程序段用于构成一个简单的单向链表,填空。

structSTRU

{intx,y;

floatrate;

__structSTRU*____p;

}a,b;

a.x=0;a.y=0;a.rate=0;a.p=b;

b.x=0;b.y=0;b.rate=0;b.p=NULL;

42、以下程序从终端读入数据到数组中,统计其中正数的个数,并计算它们之和,请填空。

main()

{int

文档评论(0)

1亿VIP精品文档

相关文档