输入数据,求平均值,输出比平均值大的数据和位置,并统计个数。

本文介绍了一种处理和分析输入数据的方法,包括数据输入、数据筛选、平均值计算、数据排序以及数据统计分析等核心步骤。通过实例演示了如何高效地收集、处理并分析数据,为后续的数据科学应用打下坚实基础。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

#include<iostream>
const int ArSize = 6;
int main()
{
using namespace std;
float naaq[ArSize];
cout << "Enter the NAAQS\n";
int i = 0;
float temp;
cout << "First value: ";
cin >> temp;
while (i < ArSize&&temp >= 0)
{
naaq[i] = temp;
++i;
if (i < ArSize)
{
cout << "Next value: ";
cin >> temp;
}
}
if (i == 0)
cout << "No data--byte";
else
{
cout << "Enter your NAAQ: ";
float you=0;
float avarge = 0;
for (i = 0; i < ArSize; i++)
{
you += naaq[i];


}
avarge = you / ArSize;
cout <<avarge<<endl;
int count = 0;
int j = 0;
int k = 0;
for (; j < i;j++)
if (naaq[j]>avarge)
{
count++;
cout <<"the position is"<<j <<" the number is "<< naaq[j] << endl;


}

cout <<count;

cout << " of youneighbors\n";
}
return 0;

}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值