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");
     }

>"Matt"
This is a string.

>char thePlayersName
This is not a string.

Since you don't seem to understand the difference between a char and a pointer to char, you should stick to using std::string objects.

How would I go about using std::string things for what I need?

Just replace each occurrence of 'char' with 'std::string' and you should be good to go.

>How would I go about using std::string things for what I need?
You start by getting a relatively modern book on C++. I'd recommend Accelerated C++ by Andrew Koenig and Barbara Moo. It uses strings religiously. What you're trying to do now is use C-style strings, but I get the feeling that your command of pointers is weak, so any attempt at using C-style strings properly is assured to fail. std::strings are much easier to use. But don't forget to include <string>.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.