试题与答案

1.______ ________(多亏了)the rain ,we can g

题型:填空题

题目:

1.______ ________(多亏了)the rain ,we can get a goodharvest this year.

2._______ ________(人们认为)that people will travel tothe moon quite often.

3.We have got__________________(更多的)rice.

4.The old people in the old people's home are____________ _______ _______(过着幸福的生活).

5.I'm trying to eat less because I don't want to______ ______ _______(增重).

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0512/fbfb643ef29dcba9a2efab43c0ee09dc.html

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

参考答案:A

试题推荐
题型:问答题

已知数据文件in.dat中存有300个四位数,并已调用读函数readDat()把这些数存入数组a中,请编制一函数jsValue(),其功能是:求出所有这些四位数是素数的个数cnt,再求出所有满足此条件的四位数平均值pjz1,以及所有不满足此条件的四位数平均值pjz2。最后main()函数调用写函数writeDat()把结果cnt,pjz1,pjz2输出到out.dat文件中。
例如:5591是素数,该数满足条件,参加计算平均值pjz1,且个数cnt=cnt+1。
9812是非素数,该数不满足条件,参加计算平均值pjz2。
注意:部分源程序存在test.c文件中。
程序中已定义数组:a[300],已定义变量:cnt,pjz1,pjz2
请勿改动数据文件in.dat中的任何数据、主函数main()、读函数readDat()和写函数writeDat()的内容。
#include <stdio.h> //include语句说明各程序中包含vc6.0中的标准输入输出库函数stdio.h
int a[300],cnt=0; //定义整型数组a[300]和变量cnt,变量cnt赋初值为0
double pjz1=0.O,pjz2=0.0; //定义变量pjz1,pjz2并赋初值为0.0
void writeDat(); //输出函数说明语句
void readDat(); //输入函数说明语句
int isP (int m) //函数isP (int m)判断m是否为素数,如果是素数则返回1,否则返回0

int i;
for(i=2;i<m; i++)
if (m%i==0)
return 0;
return 1;

void jsValue() //函数jsValue()的定义语句


main()

readDat(); //调用readDat()函数,从in.dat文件中读入300个四位数存入数组a中
jsValue(); //调用jsValue()函数,实现题目所要实现的功能
writeDat(); //调用writeDat()函数,把计算结果cnt,pjz1,pjz2输出到out.dat文件中
printf("cnt=%d\n 满足条件的平均值pzj1=%7.2lf\n不满足条件的平均值pzj2=%7.2lf\n”,
cnt,pjz1,pjz2); //在屏幕上显示计算的结果

void readDat() //从in.dat文件中读入300个四位数存入数组a中

FILE *fp; //定义文件指针变量fp
int i; //定义变量i
fp=fopen("in.dat","r"); //以只读方式打开文件in.dat,并且文件指针fp指向文件in.dat
for (i=0; i<300; 1++) //循环变量i从0依次递增到299
fscanf( fp,"%d,",&a[i]); //从文件in.dat中读入300个四位数存入数组a中
fclose(fp); //关闭文件in.dat

void writeDat() //把计算结果写入到out.dat文件

FILE *fp; //定义文件指针变量fp
fp=fopen("out.dat","w"); //以只写方式打开文件out.dat,并且文件指针fp指向文件out.dat
fprintf(fp,"%d\n%7.2lf\n%7.2lf\n",cnt,pjz1,pjz2); //在屏幕上显示计算结果
fclose(fp); //关闭文件out.dat

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