Hi guys, need some help in writing a progrom to test my code. Currently, what i have written for the header file is this
#ifndef _VENDMACHINE_H_
#define _VENDMACHINE_H_
#include <string>
class VendMachine
{
private:
string item;
int numberOfItems;
int cost;
public:
VendMachine(string s, int = 50, int = 50);
void setItem(string);
string getItem();
void setNumberOfItems(int);
int getNumberOfItems();
void setCost(int);
int getCost();
void makeSale(int=1);
};
#endif
my methods and declaration
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
#include "vendMachine.h"
VendMachine::VendMachine(string s, int n, int c) {
item = s;
numberOfItems = n;
cost = c;
}
void VendMachine::setItem(string s){
item = s;
}
string VendMachine::getItem(){
return item;
}
void VendMachine::setNumberOfItems(int n){
numberOfItems = n;
}
int VendMachine::getNumberOfItems(){
return numberOfItems;
}
void VendMachine::setCost(int c){
cost = c;
}
int VendMachine::getCost(){
return cost;
}
void VendMachine::makeSale(int i){
numberOfItems = numberOfItems -i;
}
currently i'm given a function prototype sellProduct
void sellProduct(vendMachine& product);
and this
#include <iostream>
#include "vendMachine.h"
using namespace std;
void sellProduct(vendMachine& product);
int main()
{
vendMachine coke("coke", 2, 50);
vendMachine pesi("pesi", 20, 65);
vendMachine gum("snack", 50, 45);
vendMachine chips("chips", 50, 85);
cout << "user name Program Output: " << endl;
cout << "============================" << endl;
while (true)
{
sellProduct(coke);
sellProduct(pesi);
sellProduct(gum);
sellProduct(chips);
}
cin.ignore();cin.ignore();
return 0;
}
and i keep getting this
error LNK2019: unresolved external symbol "void __cdecl sellProduct(class VendMachine &)" (?sellProduct@@YAXAAVVendMachine@@@Z) referenced in function _main
when i run the program..anyone can help?
Thanks in advance