I'm back again.
I am trying to get some functions to run in my program, and some reason it just isn't wanting to work. I have been trying different ways to get this working, but no luck so far.
The thing compiles fine, but when I try to run it I get this error:
Here is my input:
The program is largely incomplete, but I am stuck on this best buy calculation that is refusing to run.
I am trying to get some functions to run in my program, and some reason it just isn't wanting to work. I have been trying different ways to get this working, but no luck so far.
The thing compiles fine, but when I try to run it I get this error:
Code:
1>estepPass9.obj : error LNK2019: unresolved external symbol "double __cdecl bestbuy(double &,double &,double,double,double)" (?bestbuy@@YANAAN0NNN@Z) referenced in function _main
1>C:\Users\Mark\Documents\Visual Studio 2010\Projects\Pass9\Debug\Pass9.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
Here is my input:
Code:
#include <iostream>
#include <iomanip>
using namespace std;
void bestbuy (double &min, int &lownumber, double price1, double price2, double price3);
void discountResults (double price, double discountPercent);
void howMany (double amountMoney, double cost);
int main()
{
int menu =0;
int b=0;
double a=0, c=0, d=0, e=0;
char choice;
while (menu != 99)
{
cout << "(B)est Buy Calculation" << endl;
cout << "(D)iscount Calculation" << endl;
cout << "(H)ow Many Calculation" << endl;
cout << "(Q)uit" << endl << endl;
cout << "Please enter the option (B, D, H, or Q)" << endl;
cin >> choice;
switch(choice)
{
case 'b':
case 'B':
bestbuy(a, b, c, d, e);
cout << "The smallest price is " << a << "and is price number" << b << endl;
break;
case 'd':
case 'D': cout << "You entered D" << endl;
break;
case 'h':
case 'H': cout << "You entered H" << endl;
break;
case 'q':
case 'Q': cout << "You entered Q" << endl;
system("pause");
return 0;
break;
default: cout << "Please enter B, D, H, or Q" << endl;
break;
}
cout << "Please enter the option (B, D, H, or Q)" << endl;
}
return 0;
}
void bestbuy(double min, int lownumber, double price1, double price2, double price3)
{
cout << "Please enter three prices seperated by a space" << endl;
cin >> price1 >> price2 >> price3;
if (price1<=price2 && price1 <= price3)
{
min=price1;
lownumber=1;
}
else if (price2 <=price1 && price2 <=price3)
{
min=price2;
lownumber=2;
}
else
{
min=price3;
lownumber=3;
}
}
The program is largely incomplete, but I am stuck on this best buy calculation that is refusing to run.