试题与答案

已知数据文件IN87.DAT中存有300个4位数,并已调用函数readDat()把这

题型:问答题

题目:

已知数据文件IN87.DAT中存有300个4位数,并已调用函数readDat()把这些数存入数组a中,请编制一函数isValue(),其功能是:求出千位数上的数加个位数上的数等于百位数上的数加十位数上的数的个数cnt,再求出所有满足此条件的4位数平均值pjz1,以及所有不满足此条件的4位数的平均值pjz2,最后调用函数writeDat()把结果cnt,pjz1,pjz2,输出到out87.dat文件中。
例如:6712,6+2=7+1,则该数满足条件,计算平均值pjz1,且个数cnt=cnt+1。
8129,8+9≠1+2,则该数不满足条件,计算平均值pjz2。
注意:部分源程序已给出。
程序中已定义数组:a[300],b[300],已定义变量:cnt,pjz1,pjz2。
请勿改动主函数main()、读函数readDat()和写函数writeDat()的内容。
试题程序:
#include<stdio .h>
int a[300], cnt=0;
double pjz1=0.0,pjz2=0.0;
void jsValue()


main ( )

int i;
readDat ( );
jsValue();
writeDat ( );
printf ( "cnt=%d\n满足条件的平均值pjz1=%7.21fkn不满足条件的平均值pjz2=%
7.21f\n",cnt,pjz1,pjz2);

readDat ( )

FILE *fp;
int i;
fp=fopen( "in87.dat","r");
for (i=0; i<300; i++)
fscanf(fp,"%d,",&a[i]);
fclose(fp);

writeDat ( )

FILE *fp;
int i;
fP=fopen("out87.dat","w");
fprintf(fP,"%dkn%7.21f\n%7.21f\n",cnt ,pjz1,pjz2);
fclose(fp);

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2018/0501/8e1b971312639efc587ab0f2d6e52d55.html

下面是错误答案,用来干扰机器的。

参考答案:B解析: 《麻醉药品和精神药品管理条例》第41条规定:“医疗机构应当对麻醉药品和,精神药品处方进行专册登记,加强管理。麻醉药晶处方至少保存3年,精神药品处方至少保存2年。

试题推荐
题型:单项选择题 案例分析题

患者男性,有咳嗽.咳痰病史10余年,逐年加重。入冬后咳嗽明显,咳白色粘稠痰。近一周胸闷,气急,活动时加剧。嘴唇紫绀,头痛,精神软弱,有时出现神情恍惚而就医。体检:T37℃,P88次/分,R25次/分,BP110/84mmHg。桶状胸。语颤消失。叩诊过清音,心浊音界缩小,肺下界,肝浊音界下降。听诊心音遥远,肺呼吸减弱。呼气延长。

提示:患者第一秒用力呼气量1.0L。一般情况下第一秒用力呼气量1.0L时生存期约为多少年()

A.生存期约为2年

B.生存期约为5年

C.生存期约为10年

D.生存期约为12年

E.生存期与正常人无明显差异

查看答案
题型:阅读理解

Coketown was a town of red brick, or of brick that would have been red if the smoke and ashes had allowed it; but in fact it was a town of unnatural red and black like the painted face of savage(野人). It was a town of machinery and tall chimney, out of which smoke trailed themselves for ever and ever. It had a black canal in it, and a river that ran purple with ill smelling color, and large piles of building full of windows where there was a rattling and a trembling all day long, and where the steam-engine worked up and down like the head of an elephant in a state of madness. The town contained several large streets all very like one another, and many small streets still more like one another, inhabited by people equally like one another.

A sunny midsummer day. There was such a thing sometimes even in Coketown. Seen from a distance in such weather, Coketown lay covered in a smoke of its own. You only knew the town was there, because you knew there could have been no such a place upon the view without a town.

The streets were hot and dusty on the summer day, and the sun was so bright that it even shone through the smoke over Coketown, and could not be looked at steadily. Workers appeared from low underground doorways into factory yards, and sat on steps, wiping their face sand looking at coals. The whole town seemed to be frying in oil. There was a smell of hot oil everywhere. The atmosphere of those places was like the breath of hell(地狱), and their inhabitants wasting with heat, walked lazily in the desert. But no temperature made the mad elephants more mad or more sane(理智的). Their tiresome heads went up and down at the sane rate, in hot weather and in cold, wet weather and dry. The measured movement of their shadows of wood; while for the summer noise of insects, it could offer all the year round, from the dawn of Monday to the night of Saturday.

67. Which of the following words is NOT properly used to describe Coketown ?

A. unpleasant         B. dirty              C. noisy           D. deserted

68. From the passage we know that Coketown was mainly a(n)_____town.

A. industrial            B. agricultural       C. historical           D. cultural

69. Only _____ were not affected by weather.

A. the workmen           B. the habitants      C. the steam-engines     D. the woods

70. Which is the author’s opinion of Coketown?

A. Coketown should be replaced by woods       B. The town had too much oil in it

C. The town was seriously polluted             D. The town’s atmosphere was unchanged

查看答案
微信公众账号搜索答案