I got the program to work that i was using and then I decided to make another version of it where it will go through the process multiple times. I compile it and get no errors, but when i go to run it, i get these errors.
error LNK2001: unresolved external symbol _WinMain@16
fatal error LNK1120: 1 unresolved externals
heres the code.
Code:
#include<iostream.h>
class GroceryItem
{
private:
int stockNum;
double priceEach;
int quantity;
double totalValue;
void calculateTotalValue(double, int);
public:
void setStockNum();
void setPriceEach();
void setQuantity();
void setGroceryVariables();
void displayGroceryItem(int, double, int, double);
};
void GroceryItem::setStockNum()
{
cout<<"Enter the Stock Number: ";
cin>>stockNum;
};
void GroceryItem::setPriceEach()
{
cout<<"Enter the price: ";
cin>>priceEach;
};
void GroceryItem::setQuantity()
{
cout<<"Enter the quantity in stock: ";
cin>>quantity;
};
void GroceryItem::calculateTotalValue(double, int)
{
totalValue=priceEach*quantity;
};
void GroceryItem::displayGroceryItem(int, double, int, double)
{
cout<<"Item #"<<stockNum<<" Price: "<<priceEach<<endl;
cout<<"Quantity in stock: "<<quantity<<" Value: "<<totalValue;
};
void GroceryItem::setGroceryVariables()
{
setStockNum();
setPriceEach();
setQuantity();
calculateTotalValue(priceEach, quantity);
displayGroceryItem(stockNum, priceEach, quantity, totalValue);
};
int main()
{
int num;
GroceryItem anItem;
for (num=1; num<3; ++num)
{
anItem.setGroceryVariables();
};
}