参考代码:
#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语言代码)浏览:861 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:492 |
printf基础练习2 (有点不明白)浏览:798 |
WU-格式化数据输出 (C语言代码)浏览:1662 |
C语言程序设计教程(第三版)课后习题6.6 (C++代码)浏览:599 |
The 3n + 1 problem (C语言代码)浏览:521 |
C语言训练-数字母 (C语言代码)浏览:563 |
sizeof的大作用 (C语言代码)浏览:1268 |
蚂蚁感冒 (C语言代码)浏览:1253 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:541 |