先创建文本文件IN.DAT,在文件中写20个四位整数。 编写函数readDat()把从文件中读出这些数并存入数组a中;编写函数Calvalue( ), 其功...
代码说明:
先创建文本文件IN.DAT,在文件中写20个四位整数。 编写函数readDat()把从文件中读出这些数并存入数组a中;编写函数Calvalue( ), 其功能要求: 1. 求出这文件中共有多少个正整数totNum 2. 求这些数右移1位后, 产生的新数是偶数的数的个数totCnt, 以及满足此条件的这些数(右移前的值) 的算术平均值totPjz。 最后在main( )函数中把所求的结果输出。-First create a text file IN.DAT, wrote in the paper four integer 20. The preparation of function readDat () to read from the file into an array of these and a number of preparation function Calvalue (), its functional requirements: 1. Obtained in this paper the total number of positive integer totNum 2. For those few shifted to right one after the new number is the number of even a few totCnt, as well as to meet the conditions of these (the value of the pre-shifted to right) the arithmetic mean totPjz. Finally, in the main () function to output the results of the request.
下载说明:请别用迅雷下载,失败请重下,重下不扣分!