Other suggestions:
#1.
Code:
#include <iostream>
using namespace std;
class person
{
...
string name;
...
string country;
...
Make sure you've also got #include <string> in addition to the <iostream> header. Your implementation may pull in the necessary header for the string object to work but you really do not want to rely on this. Since you're using string containers, include the string header.
#2.
Code:
class person
{
public:
person();
...
};
person::person()
{
this->name = "Unnamed Person";
this->age = 50;
this->sex = true;
this->country = "United States";
}
For such a constructor, the preferred method of initialization is to use something a bit different, for example:
Code:
class person
{
public:
person() : name("Unnamed Person"), age(50), sex(true), country("United States") {};
...
};
#3.
Code:
class person
{
...
string sexString()
{
string returnString;
returnString = (this->sex == true) ? "guy" : "woman" ;
return returnString;
}
};
Member functions that do not alter the class (change the value of any of its member variables) should be declared const. The function can also be simplified a bit:
Code:
class person
{
...
string sexString() const
{
return sex ? "guy" : "woman" ;
}
};
#4.
Code:
void introduce(person person)
{
cout<<"\nHi, my name is "<<person.name<<". I'm a "<<person.age<<" years old "<<person.sexString()
<<", and I live in "<<person.country<<"."<<endl;
cin.get();
}
When passing objects into function, prefer to use a reference parameter. Also, since the function does not do anything to alter the member variables of the passed in object, it should be passed in as const:
Code:
void introduce(const person& person)
{
cout<<"\nHi, my name is "<<person.name<<". I'm a "<<person.age<<" years old "<<person.sexString()
<<", and I live in "<<person.country<<"."<<endl;
cin.get();
}