I’m working on a assignment for class so this is only part of the code, but whenever I try to compile it I’m getting this error.
1>pass9.obj : error LNK2019: unresolved external symbol "void __cdecl bestbuy(double,double,double)" (?bestbuy@@YAXNNN@Z) referenced in function _main
1>C:\Users\YoggieBear\Desktop\school\pass9\Debug\pass9.exe : fatal error LNK1120: 1 unresolved externals
Code is below
#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;}
}
Your function declaration does not match your function definition.
Update it as below: