参考代码:
#include<iostream> #include<iomanip> using namespace std; int main(){ int count = 0; double arg = 0; int x[20]; for(int i=0; i<20; i++){ cin >> x[i]; if(x[i]<0) count++; if(x[i]>0) arg += x[i]; } arg = arg / (20-count); cout << count << endl; cout << setiosflags(ios::fixed) << setprecision(2) << arg; return 0; }
0.0分
5 人评分
C语言程序设计教程(第三版)课后习题6.9 (C++代码)论pow函数的应用浏览:958 |
上车人数 (C语言代码)浏览:1007 |
C二级辅导-统计字符 (C语言代码)浏览:486 |
C语言程序设计教程(第三版)课后习题9.10 (C语言代码)浏览:555 |
破解简单密码 (C语言代码)浏览:1495 |
C语言程序设计教程(第三版)课后习题6.7 (C语言代码)浏览:558 |
C语言训练-字符串正反连接 (C语言代码)浏览:556 |
C语言训练-求素数问题 (C语言代码)浏览:665 |
C语言训练-素数问题 (C语言代码)浏览:870 |
A+B for Input-Output Practice (IV) (C++代码)浏览:638 |