Can anyone tell me why this doesn't work? I know it's probably really easy, but I did try....
/* ISU program created by Matt
in grade 12 programming. */
#include <iostream>
#include <list>
#include <iterator>
using namespace std;
class humanPlayer
{
public:
humanPlayer(char thePlayersName, unsigned int thePlayersTurnNum); //constructor
~humanPlayer(){};
void addToList(unsigned int countryToAdd) {countriesOwned.push_back(countryToAdd);}
void showList();
void removeFromList(unsigned int countryToRemove) {countriesOwned.remove(countryToRemove);}
void checkIfInList(unsigned int countryToCheck);
char returnPlayerName() {return playerName;}
private:
list<int> countriesOwned;
char playerName;
unsigned int playerTurnNum;
};
humanPlayer::humanPlayer(char thePlayersName, unsigned int thePlayersTurnNum)
{
playerName = thePlayersName;
playerTurnNum = thePlayersTurnNum;
}
void humanPlayer::checkIfInList(unsigned int countryToCheck)
{
if(find(countriesOwned.begin(), countriesOwned.end(), countryToCheck) != countriesOwned.end())
{
cout << countryToCheck << " is in the list.\n";
}
else
{
cout << countryToCheck << " is NOT in the list.\n";
}
}
void humanPlayer::showList()
{
copy(countriesOwned.begin(),countriesOwned.end(),ostream_iterator<int>(cout,", "));
cout << endl;
}
int main()
{
humanPlayer test("Matt", 1);
system("PAUSE");
}