OK, I took a break from my program for a little while and I came back to it and tried to make any necessary changes to it but when I run it then window opens and then closes again. I don't know if I am calling the GameManager's constructor wrong or something in the main() function. I do "GameManager();" when I want to run the constructor for GameManager.cpp.
This is the main() function
Code:
int main()
{
cout << "::Welcome to Robo Madness::\n\n";
GameManager();
return 0;
}
and the GameManager.cpp constructor
Code:
GameManager::GameManager() : money(200), lives(3), attack(0), defense(0)
{
ShopClass shop;
BattleClass battle;
cout << "Current Status:\n";
cout << "Money: $" << money << "\n";
cout << "Lives: " << lives << "\n";
cout << "Attack Points: " << attack << "\n";
cout << "Defense Points: " << defense << "\n";
cout << "Would you like to visit the shop or battle robots?\n(Please enter either Shop or Battle)\n";
cin >> ShopBattle;
if (ShopBattle == "Shop" || ShopBattle == "shop") {
ShopClass();
} else if (ShopBattle == "Battle" || ShopBattle == "battle") {
BattleClass();
} else {
cout << "Error: Invalid Input";
GameManager();
}
}
I'm not sure if I'm supposed to put all of that code that's in the constructor in it's own function or not.