皮皮学,免费搜题
登录
logo - 刷刷题
搜题
【单选题】
已知数据文件IN.dat中存有300个四位数,并已调用读函数RData()把这些数存入数组a中,函数diffVal()功能是:求出千位上的数减百位上的数减十位上的数减个位上的数大于0的个数count,再求出所有满足此条件的四位数的平均值ave1,以及不满足此条件的四位数的平均值ave2。最后调用写函数WData(),把结果输出到OUT.dat文件中。例如,9123,9-1-2-3>0,则该数满足条件,计算平均值ave1,且个数count=count+1。9812,9-8-1-2<0,则该数不满足条件,计算平均值ave2。按要求在空白处填写适当的表达式或语句,使程序完整并符合题目要求。#include inta[300],count=0;doubleave1=0.0,ave2=0.0;voiddiffVal(){inti,thou,hun,ten,data,n=0;for(i=0;i<300;i++){thou=a[i]/1000;hun=a[i]%1000/100;ten=a[i]%100/10;data=a[i]%10;if(thou-hun-ten-data>0){______________________;ave1+=a[i];}else{______________________;ave2+=a[i];}}ave1/=count;______________________;}voidRData(){FILE*fp;inti;fp=fopen("IN.dat","r");for(i=0;i<300;i++)fscanf(fp,"%d,",&a[i]);fclose(fp);}voidWData(){FILE*fp;fp=fopen("OUT.dat","w");fprintf(fp,"%d\n%7.2f\n%7.2f\n",count,ave1,ave2);fclose(fp);}voidmain(){RData();diffVal();WData();printf("count=%d\n满足条件的平均值pzj1=%7.2f\n不满足条件的平均值pzj2=%7.2f\n",count,ave1,ave2);}
A.
第1处:count++ 第2处:n++ 第3处: ave2 /= n
B.
第1处:n++ 第2处:count++ 第3处: ave2 /= n
C.
第1处:n++ 第2处:count++ 第3处: ave1 /= n
D.
第1处:count++ 第2处:n++ 第3处: ave2 /= count
手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
参考答案:
举一反三
【单选题】现用某方法治疗某种疾病,针对每位病人的的治愈率都为p,独立地治疗了n位患者,问治愈人数服从的分布是_______
A.
泊松分布
B.
二项分布
C.
正态分布
D.
卡方分布
【单选题】ABC Inc. Trial Balance December 31 Debit CreditCash $ 15Accounts Receivable 25Equipment 190Accounts Payable $ 20Capital Stock ...
A.
All accounts.
B.
Revenue and expenses.
C.
Revenue, expenses, and dividends.
D.
All accounts that are not nominal.
【单选题】ABC Inc.Trial BalanceDecember 31Debit CreditCash$ 15Accounts Receivable 25Equipment 190Accounts Payable $ 20Capital Stock 105Retained Earnings 55Dividends 10Service Revenue 185Sala...
A.
115
B.
105
C.
55
D.
60
【单选题】下列对不同朝代科举制度的描述中,正确的一项是
A.
‍ ‍ 下列对不同朝代科举制度的描述中,正确的一项是 ‍ ‍ A.汉朝时最早设置科举考试的朝代
B.
隋朝发展了科举制度,设置了武举
C.
唐朝科举重视诗赋考核,并开设了进士科
D.
明朝八股取士发挥了学者的真才实学
【单选题】ABC Inc. Trial Balance December 31 Debit CreditCash $ 15Accounts Receivable 25Equipment 190Accounts Payable $ 20Capital Stock ...
A.
retained earnings of $55.
B.
dividends of $10.
C.
net income of $65.
D.
none of the above.
【单选题】ABC Inc.Trial BalanceDecember 31Debit CreditCash$ 15Accounts Receivable 25Equipment 190Accounts Payable $ 20Capital Stock 105Retained Earnings 55Dividends 10Service Revenue 185Salari...
A.
60
B.
50
C.
55
D.
125
【判断题】During February, Green Inc. paid an attorney $650 for legal services rendered in January and journalized the business transaction by debiting the Accounts Payable account and crediting the Cash accoun...
A.
正确
B.
错误
【简答题】SUNDIAL Inc. Trial Balance December 31 Debit Credit Cash $ 16 Accounts Receivable 26 Equipment 191 Accounts Payable $ 21 Capital Stock 106 Retained Earnings 56 Dividends 11 Service Revenue 189 Sala...
【单选题】ABC Inc. Trial Balance December 31 Debit CreditCash $ 15Accounts Receivable 25Equipment 190Accounts Payable $ 20Capital Stock ...
A.
240
B.
365
C.
230
D.
180
【简答题】The account balances for Creative Band, Inc. as of May 31, 2009, are listed below in alphabetical order: On June 3, Creative Band, Inc collected $4,000 of its accounts receivable and paid $7,000 of it...
相关题目:
参考解析:
知识点:
题目纠错 0
发布
创建自己的小题库 - 刷刷题