我有这个程序在 C++ 中找到最高的销售数字和平均值,但它在下面给出错误请帮助
#include <iostream>
using namespace std;
// You must add the three functions here
void getSales(float & sales1P, float & sales2P, float & sales3P,
float & sales4P) {
cout << "Enter four sales values: " << endl;
cin >> sales1P >> sales2P >> sales3P >> sales4P;
}
float calcAverage(float sales1P, float sales2P, float sales3P, float sales4P) {
return (sales1P + sales2P + sales3P + sales4P) / 4;
}
float findHighest(float sales1P, float sales2P, float sales3P, float sales4P)
{
float highest = sales1P;
if (sales2P > highest)
highest = sales2P;
if (sales3P > highest)
highest = sales3P;
if (sales4P > highest)
highest = sales4P;
}
void displayOutput(float highestSales, float averageSales) {
cout << "The highest sales figure is " << highestSales
<< " with an average of " << averageSales << endl;
}
int main()
{
float sales1,
sales2,
sales3,
sales4;
float averageSales;
float highestSales;
for (int i = 0; i < 4; i++)
// Get the sales for each division.
sales1 = getSales();
sales2 = getSales();
sales3 = getSales();
sales4 = getSales();
//
//getSales(sales1, sales2, sales3, sales4);
averageSales = calcAverage(sales1, sales2, sales3, sales4);
//getSales(sales1, sales2, sales3, sales4);
highestSales = findHighest(sales1, sales2, sales3, sales4);
displayOutput(highestSales, averageSales);
system("PAUSE");
return 0;
}
错误:
error:::: In function `int main()':
\Examples_C++\question_4a.cpp 5 C:\Examples_C++\C [Error] too few arguments to function void getSales(float&, float&, float&, float&)'
\Examples_C++\question_4a.cpp 41 C:\Examples_C++\C [Error] at this point in file
\Examples_C++\question_4a.cpp 41 C:\Examples_C++\C [Error] void value not ignored as it ought to be
\Examples_C++\question_4a.cpp 5 C:\Examples_C++\C [Error] too few arguments to function `void getSales(float&, float&, float&, float&)'
\Examples_C++\question_4a.cpp 42 C:\Examples_C++\C [Error] at this point in file
\Examples_C++\question_4a.cpp 42 C:\Examples_C++\C [Error] void value not ignored as it ought to be
\Examples_C++\question_4a.cpp 5 C:\Examples_C++\C [Error] too few arguments to function `void getSales(float&, float&, float&, float&)'
\Examples_C++\question_4a.cpp 43 C:\Examples_C++\C [Error] at this point in file
\Examples_C++\question_4a.cpp 43 C:\Examples_C++\C [Error] void value not ignored as it ought to be
\Examples_C++\question_4a.cpp 5 C:\Examples_C++\C [Error] too few arguments to function `void getSales(float&, float&, float&, float&)'
\Examples_C++\question_4a.cpp 44 C:\Examples_C++\C [Error] at this point in file
\Examples_C++\question_4a.cpp 44 C:\Examples_C++\C [Error] void value not ignored as it ought to be