I am having a great deal of trouble declaring two static variables outside of a class. They are to be used in every class an are static. I am trying to initialize them in "Main" but keep getting
51 C:\Users\William\Documents\C++_Programming\Extreme_Fruitstand.cpp expected primary-expression before '{' token
51 C:\Users\William\Documents\C++_Programming\Extreme_Fruitstand.cpp expected `;' before '{' token
/*******************************************************************************
* Extreme Fruitstand
*
*
*
*
*
*
*******************************************************************************/
#include <iostream.h>
#include <stdlib.h>
usingnamespace std;
//Classes
class City
{
public:
staticint money;
staticint store[];
// non static Variables
int cocnutPrice;
int honeydewPrice;
int melonPrice;
int applePrice;
int elderberryPrice;
int watermelonPrice;
int cherryPrice;
bool copsPresent;
//fucntions
// Remember Static functions can only take static variables
int getCoconutPrice();
int getHoneydewPrice();
int getMelonPrice();
int getApplePrice();
int getElderberryPrice();
int getWatermelonPrice();
int getCherryPrice();
private:
};
int main()
{
// assign the money to 1000
City::money = 1000;
// The store is how much of each thing you have
// We start at Zer for everone
City::store = {0,0,0,0,0,0,0};
//How many days you have left Stating from 31;
int daysLeft = 31;
City Chicago, New_york, LosAngeles, Sheboygan, Milwaukee;
int a = 0;
a = Chicago.getCoconutPrice();
cout << "the value of a is " << a << endl;
system("pause");
return 0;
}
int City::getCoconutPrice()
{
int random = rand() % 4000 + 1;
int price = random + 14000;
return price;
}