标签:turn avg color += return ios ace 求和 names
#include <iostream> using namespace std; int main(){ int sum,max=0,min=100,a[3]; float avg; sum=0; for (int i=1;i<=9;++i) { //cin >> a[i]; a[i]=rand()% 100; cout<<a[i]<<endl; sum += a[i]; if (a[i]<=min) min=a[i]; if (a[i]>=max) max=a[i]; } avg=sum/9; cout <<endl<< sum<<endl; cout <<avg<<endl; cout <<max<<endl; cout <<min<<endl; return 0; }
随机产生9个数,利用数组求和,平均数,最大值,最小值
标签:turn avg color += return ios ace 求和 names
原文地址:https://www.cnblogs.com/lucasyy/p/13232964.html