参考代码:
#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 人评分
Hello, world! (C语言代码)浏览:1136 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:569 |
C语言程序设计教程(第三版)课后习题11.5 (C语言代码)浏览:854 |
A+B for Input-Output Practice (VI) (C++代码)浏览:407 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:268 |
字符串问题 (C语言代码)浏览:1278 |
字符串对比 (C语言代码)浏览:1329 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:1264 |
C语言程序设计教程(第三版)课后习题6.8 (C++代码)浏览:551 |
【蟠桃记】 (C语言代码)浏览:998 |