网站大量收购独家精品文档,联系QQ:2885784924

7计算指定个数的数中奇偶数的个数及方差(国外英文资料).doc

7计算指定个数的数中奇偶数的个数及方差(国外英文资料).doc

  1. 1、本文档共17页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
7计算指定个数的数中奇偶数的个数及方差(国外英文资料)

7计算指定个数的数中奇偶数的个数及方差(国外英文资料) 52 sets of Read the 200 integers in the file in.dat into array xx. Please prepare jsValue () function, requirement: find out the value in array xx for cnt1 odd number and the number of values for the even cnt2 xx and array subscript is even elements (including index of 0) arithmetic average of the element value pj. Result cnt1, cnt2, pj output to out.dat. 【 reference 】 Int I; Cnt1 = 0; Cnt2 = 0; Pj = 0; The / * for loop statement calculates the number of Numbers in the array xx as an odd number of cnt1 and the number of an even number, and the number of values of an even number of elements For (I = 0; I N; I + +) / / cyclic variable I starts at 0, increments by 1, until its value is less than N { If (xx [I] % 2) / / if the value of xx [I] is odd, the variable cnt1 plus 1 The else cnt2 + +; / / otherwise, the value of xx [I] is even, the variable cnt2 + 1 If (I % 2 = 0). / / if the array xx index I is even, the value of xx [I] is added to the variable pj } Pj / = 100.0; / / variable pj divided by 100.0 is the average value of the element value of the array xx sub I, which is an even number 53 sets Read the 200 integers in text in.dat into array xx. Please compile the jsValue () function, which requires you to find the number of odd Numbers cnt1 and the number of integers in the array xx, as well as the number of element values of an odd number, and the value of the array xx, which is an odd number of element values, pj. Result: cnt1, cnt2, pj output to out.dat. 【 reference 】 Int I; Cnt1 = 0; Cnt2 = 0; Pj = 0; For (I = 0; I N; I + +) { If (xx [I] % 2) The else cnt2 + +; If (I % 2) / / if the array xx index I is odd, the value of xx [I] is added to the variable pj } Pj / = 100.0; 54 sets of It is known that there are a number of positive integers of four decimal digits in the in.dat, and the function ReadDat () reads these positive integers and puts them in the array xx. Please compile the function CalValue () and its functional requiremen

您可能关注的文档

文档评论(0)

f8r9t5c + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8000054077000003

1亿VIP精品文档

相关文档