このコードが機能しない理由がわかりません。助けていただければ幸いです。何をしても同じエラーが発生します。より多くの引数を渡す必要があることはわかっていますが、何を追加できるかわかりません。
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
double getSales();
void findHighest(double sale[]);
int main()
{
double sales;
const int ARRAY_SIZE = 4;
double salesNE, salesSE, salesNW, salesSW;
double highest = 0;
string winner;
string names[ARRAY_SIZE] = {"Northeast", "Southeast", "Northwest", "Southwest"};
double sale[ARRAY_SIZE];
int counter = 0;
cout<<"Input data for the Northeast Division:"<<endl;
sale[0] = getSales();
cout<<"Input data for the Southeast Division:"<<endl;
sale[1] = getSales();
cout<<"Input data for the Northwest Division:"<<endl;
sale[2] = getSales();
cout<<"Input data for the Southwest Division:"<<endl;
sale[3] = getSales();
findHighest();
system("PAUSE");
return 0;
}
double getSales()
{
double sales;
validate:
cout<<"Enter the quaterly sales figures for this division:"<<endl;
cin>>sales;
if (sales < 0)
{
system("CLS");
cout<<"Invalid input: sales figures must be higher than $0.00"<<endl;
goto validate;
}
return sales;
}
void findHighest(double sale[])
{
const int ARRAY_SIZE = 4;
double highest = 0;
int counter = 0;
string winner;
string names[ARRAY_SIZE] = {"Northeast", "Southeast", "Northwest", "Southwest"};
while (counter < ARRAY_SIZE)
{
if (sale[counter] > highest)
{
highest = sale[counter];
winner = names[counter];
}
counter += 1;
}
cout<<"The "<<winner<<" division had the highest grossing sales at $"<<highest<<"." <<endl;
}