I am having trouble overloading my function JustSold() with the array for CartSales[x].Cart . I can't seem to get the array to properly import....any ideas?
#include <iostream>
#include <fstream>
using namespace std;
class HotDogStand
{
public:
void JustSold(int DogCounter, int numCarts, int HotDogStand[]);
int Cart;
int IdNumber;
int SalesToday;
int TotalSales;
int IncrementalSale;
int DogCounter;
static int HotDogCartSales;
};
static int HotDogCartSales;
int main()
{
int numCarts;
HotDogStand HotDogSales;
cout << "Please Enter The Number of Carts: ";
cin >> numCarts;
HotDogStand * CartSales = new HotDogStand[numCarts];
HotDogSales.DogCounter = 0;
for(int x=0; x<numCarts; x++)
{
cout << "ID of Cart #" << x+1 << ": ";
cin >> CartSales[x].Cart;
for (int y=0;y<1; y++)
{
cout << "How many Hot Dogs Did Cart # " << CartSales[x].Cart << " sell?"<< endl;
cin >> CartSales[y].Cart;
HotDogSales.DogCounter += CartSales[y].Cart;
}
}
cout << endl;
cout << "Total Hot Dogs Sold Thus Far = " << HotDogSales.DogCounter << endl;
cout << endl;
HotDogSales.JustSold(HotDogSales.DogCounter, numCarts, HotDogStand[]);
return 0;
}
void HotDogStand::JustSold(int DogCounter, int numCarts, int HotDogStand[])
{
int Answer;
int JustSoldCounter, x;
while (true)
{
for (x=1;x<=5000;x++)
{
cout << "Did Your Carts # " << CartSales[x].Cart << " Sell a Hot Dog?" << endl;
cout << "Enter 1 for Yes, or 2 for No" << endl;
cin >> Answer;
JustSoldCounter = 0;
if (Answer == 1)
{
DogCounter += 1;
cout << DogCounter;
cout << endl;
}
else if (Answer == 2)
{
cout << DogCounter;
}
else
{
cout << "Error!" << endl;
break;
}
}
}
}