想问下这段代码为什么会编译错误
我是个初学者自己怎么想都想不出问题出在哪想请大家指点下#include<iostream>
const int Max = 10;
int main()
{
using namespace std;
double donation[Max];
double sum = 0;
double ave = 0;
int count = 0;
int i = 0;
cout << "请输入最多10个donation值(输入非数字时将结束输入)\n";
cout << "donation#1: ";
while (i < Max && cin >> donation[i])
{
sum += donation[i];
if (++i < Max)
cout << "donation#" << i + 1 << ": ";
}
if (0 == i)
cout << "没有donation.\n";
ave = sum / i;
for (int j = 0; j < i;j++)
{
if (donation[j] > ave)
++count;
}
cout << "平均值: " << ave << " "
<< count << " 个数字超过平均值.";
cin.get();
cin.get();
return 0;
}
为什么编译时一直提示:'ave' is a assigned a value that is never used in function main()