stu_test3_3.cpp: In static member function ‘static double Salesman::CalculateAveragePrice()’: stu_test3_3.cpp:21:12: error: ‘sumlesamount’ was not declared in this scope return sumlesamount; ^~~~~~~~~~~~ stu_test3_3.cpp:21:12: note: suggested alternative: ‘salesamount’ return sumlesamount; ^~~~~~~~~~~~ salesamount
时间: 2023-07-05 21:34:17 浏览: 134
这段代码中出现了一个错误。在Salesman类的静态成员函数CalculateAveragePrice中,返回值sumlesamount未被声明,因此编译器报错。我猜测可能是代码书写错误,应该为salesamount。因此,应该将代码修改为:
```c++
double Salesman::CalculateAveragePrice()
{
return sum/salesamount;
}
```
这样,该函数将会正确地计算并返回销售平均价。
阅读全文