2022-11-19 03:38发布
#include #include int main(){ using namespace std; valarray
#include <iostream>#include <valarray>int main(){ using namespace std; valarray<double> number(5); cout << "请输入5个浮点数: "; for(int i = 0;i < 5;i++) cin >> number[i]; cout << "平均数为: " << number.sum()/5 << endl; cout << "最大数为: " << number.max() << endl; cout << "最小数为: " << number.min() << endl; return 0;}本回答被提问者采纳
最多设置5个标签!
#include <iostream>
#include <valarray>
int main()
{
using namespace std;
valarray<double> number(5);
cout << "请输入5个浮点数: ";
for(int i = 0;i < 5;i++)
cin >> number[i];
cout << "平均数为: " << number.sum()/5 << endl;
cout << "最大数为: " << number.max() << endl;
cout << "最小数为: " << number.min() << endl;
return 0;
}本回答被提问者采纳
一周热门 更多>