У меня возникли проблемы с эталонными параметрами. Значения в getStockInfo
должны храниться в контрольных параметрах. Я не знаю, как это сделать, так что displayStatus
принимает эти аргументы. Всякий раз, когда я помещаю что-то в getStockInfo
, он дает мне ошибку More than one onstance of overloaded function "getStockInfo" matches the argument list
.C++ параметры опорных параметров
#include <iostream>
#include <iomanip>
using namespace std;
void getStockInfo(int &, int&, double&);
void displayStatus(int &, double &);
int main()
{
int spoolsOrdered;
int spoolsStock;
double specialCharges;
cout << "Middletown Wholesale Copper Wire Company" << endl;
getStockInfo(spoolsOrdered, spoolsStock, specialCharges);
}
void getStockInfo(int &spoolsOrdered, int &spoolsStock, double specialCharges)
{
char ship;
cout << "How many spools would you like to order: ";
cin >> spoolsOrdered;
//Validate the spools ordered
while(spoolsOrdered < 1)
{
cout << "Spools ordered must be at least one" << endl;
cin >> spoolsOrdered;
}
cout << "How many spools are in stock: ";
cin >> spoolsStock;
//Validate spools in stock
while(spoolsStock < 0)
{
cout << "Spools in stock must be at least 0" << endl;
cin >> spoolsStock;
}
cout << "Are there any special shipping charges? ";
cout << "Enter Y for yes or another letter for no: ";
cin >> ship;
//Validate special charges
if(ship == 'Y' || ship == 'y')
{
cout << "Enter the special shipping charge: $";
cin >> specialCharges;
}
else
{
specialCharges = 10.00;
}
}
void displayStatus(int &backOrder, double &subtotal, double &shipping, double &total)
{
}
Посмотрите на двух местах 'getStockInfo' в коде и сравнить. – chris
Посмотрите на прототипы функций, оба из них и фактические определения. Они не равны. –