求大家帮忙看看,c++无法解析的外部符号问题

题目是C++ Primer Plus(第6版)第9章编程练习第4题吧,给个我的代码:sales.h#ifndef SALES_H_ //防止重复包含#define SALES_H_namespace SALES{ const int QUARTERS = 4; struct Sales { double sales; double average; double max; double min; }; void setSales(Sales\u0026amp; s, const double ar, int n); void setSales(Sales\u0026amp; s); void showSales(const Sales\u0026amp; s);}#endif //这行不要忘了sales.cpp#include \u0026lt;iostream\u0026gt;#include "sales.h"using namespace SALES;using std::cin;using std::cout;using std::endl;//使用using namespace std;也行void setSales(Sales\u0026amp; s, const double ar, int n){ if (n\u0026gt;QUARTERS) n = QUARTERS; s.average = 0.0; //请不要直接使用max, min, average s.max = s.min = ar; //否则这三个变量不会对Sales对象产生任何影响 for (int i = 0; i\u0026lt;n; i++) { s.sales = ar; ave += ar; if (s.max\u0026lt;ar) s.max = ar; if (s.min\u0026gt;ar) s.min = ar; } s.average /= n; for (int i = n; i\u0026lt;QUARTERS; i++) s.sales = 0.0;}void setSales(Sales\u0026amp; s){ s.average = 0.0; s.max = s.min = ar; for (int i = 0; i\u0026lt;QUARTERS; i++) { cout \u0026lt;\u0026lt; "Please enter quarter " \u0026lt;\u0026lt; (i + 1) \u0026lt;\u0026lt; " sales:" \u0026lt;\u0026lt; endl; cin \u0026gt;\u0026gt; s.sales; if (!cin) //如果输入失败应该重新输入而不是结束输入 { cin.clear(); //输入失败后请重置cin i--; } while (cin.get() != \u0026#39;\\u0026#39;) //清除缓冲区字符 continue; } for (int i = 0; i\u0026lt;QUARTERS; i++) { s.sales = ar; ave += ar; if (s.max\u0026lt;ar) //同上,请勿直接使用max, min, average s.max = ar; if (s.min\u0026gt;ar) s.min = ar; } s.average /= n;}void showSales(Sales\u0026amp; s){ for (int i = 0; i\u0026lt;QUARTERS; i++) cout \u0026lt;\u0026lt; "Quarter " \u0026lt;\u0026lt; (i + 1) \u0026lt;\u0026lt; " sales: " \u0026lt;\u0026lt; s.sales \u0026lt;\u0026lt; endl; cout \u0026lt;\u0026lt; "Maximum sales: " \u0026lt;\u0026lt; s.max \u0026lt;\u0026lt; endl; cout \u0026lt;\u0026lt; "Minimum sales: " \u0026lt;\u0026lt; s.min \u0026lt;\u0026lt; endl; cout \u0026lt;\u0026lt; "Average sales: " \u0026lt;\u0026lt; s.average \u0026lt;\u0026lt; endl;}main.cpp#include "sales.h"using namespace SALES;int main() //请勿使用void main(){ Sales A, B; //题目要求声明两个Sales对象 double example = { 1.2, 2.3, 3.4, 4.5, 5.6, 6.7, 7.8, 8.9 }; setSales(A, example, 8); setSales(B); //有一个Sales对象需要通过cin获取销售量 showSales(A); shoeSales(B); return 0; //int main()一般返回0}


    推荐阅读