// Country5a.h // This will hold the class definitions for countries // Copyright (c) 1998 Forest J. Handford ///////////////////////////////////////////////////// #ifndef Country5a_h #define Country5a_h #define MAX_PLAYERS 2 #define TRUE 1 #define FALSE 0 class CCountries { private: class CPlayer { friend CCountries; // Give CCountries access int Armies; int Money; int Territory; int Technology; int UpgradeCost; char Name[15]; CPlayer() { Armies = 5; Money = 5; Territory = 5; Technology = 1; UpgradeCost = 5; } public: // This will sell land void Grow() { char YorN = 'y'; // For Yes or No answers // Loop as long as they want to grow for(int Count=0; tolower(YorN) == 'y'; Count++) { // They most have at least one army for every territory if (Armies <= Territory) { cout<<"You need more armies for more land."< 0) { Money -= 1; Territory += 1; cout<<"You now have "<>YorN; } // If they are out of money tell them and exit else { cout<<"You are out of money!"<= Players[Player].UpgradeCost) { Players[Player].Money -= Players[Player].UpgradeCost; Players[Player].UpgradeCost *= 2; Players[Player].Technology += 1; cout<<"You now have "<>YorN; } } void Shrink(bool Player) { char YorN = 'y'; while(tolower(YorN) == 'y') { if(Players[Player].Territory > 0) { Players[Player].Money += 1; Players[Player].Territory -= 1; cout<<"You now have "<>YorN; } else { cout<<"You are out of money!"<>Players[Count].Name; cout<>YorN; } return TRUE; // Flag success } }; #endif