我正在爲類進行賦值,所以這只是代碼的一部分,但每當我嘗試編譯它時,我都會收到此錯誤。無法解析的外部符號調用函數
1>pass9.obj : error LNK2019: unresolved external symbol "void __cdecl bestbuy(double,double,double)" ([email protected]@[email protected]) referenced in function _main
1>C:\Users\YoggieBear\Desktop\school\pass9\Debug\pass9.exe : fatal error LNK1120: 1 unresolved externals
代碼如下
#include <iostream>
using namespace std;
void bestbuy(double, double, double);
void discountresults (double, double);
void howmany(double, double);
int price1, price2, price3;
int main()
{
cout<<"Please enter 3 prices.\n";//This tests function bestbuy.
cin>>price1>>price2>>price3;
bestbuy(price1,price2,price3);
cout<<"Your lowest price entered was "<<price1<<" and it was the "<<price2<<" number you entered.\n";
system ("PAUSE");
return 0;
}
void bestbuy(double &val1,double &val2, double val3)
{
if (val1 < val2 && val1 < val3)
val2 = 1;
else if (val2 < val1 && val2 < val3)
{val1 = val2;
val2 = 2;}
else
{val1 = val3;
val2 = 3;}
}
謝謝你,我不知道該函數原型不得不&S – sircrisp