编译器报错不知道哪错了
程序代码:
#include <iostream> #include <array> #include <cstring> using namespace std; const int Seasons = 4; const array<string, Seasons> Sname = {"Spring", "Summer", "Fall", "Winter"}; void fill(array<double, Seasons> *pa); void show(array<double, Seasons> da); int main() { array<double, Seasons> expenses; fill(&expenses); show(expenses); return 0; } void fill(array<double, Seasons> *pa) { for (int i = 0; i < Seasons; i++) { cout << "Enter " << Sname[i] << " expenses: "; cin >> (*pa)[i]; } } void show(array<double, Seasons> da) { double total = 0.0; cout << "\nEXPENSES\n"; for (int i = 0; i < Seasons; i++) { cout << Sname[i] << ": $" << da[i] << endl; total += da[i]; } cout << "Total Expenses: $" << total << endl; }
求大神帮忙改正一下