//personType.h
#include <string>
usingnamespace std;
class personType
{
public:
void print() const;
//Function to output the first name and last name
//in the form firstName lastName.
//void setName(string first, string last);
//Function to set firstName and lastName according
//to the parameters.
//Postcondition: firstName = first; lastName = last
void setFirstName(string first);
void setMiddleName(string middle);
void setLastName(string last);
string isFirstEqual(string& newFirst );
string isLastEqual(string& newLast);
string getFirstName() const;
//Function to return the first name.
//Postcondition: The value of firstName is returned.
string getLastName() const;
//Function to return the last name.
//Postcondition: The value of lastName is returned.
personType(string first = "",string middle = "", string last = "");
// personType(string first = "");
//Constructor
//Sets firstName and lastName according to the parameters.
//The default values of the parameters are null strings.
//Postcondition: firstName = first; lastName = last
private:
string firstName; //variable to store the first name
string lastName; //variable to store the last name
string middleName;
string newFirst;
string newLast;
};
function:
1 2 3 4 5 6 7 8 9
string personType::isFirstEqual(string& newFirst)
{
if (firstName.compare(newFirst) != 0)
std::cout << firstName << " is not " << newFirst << '\n';
else cout<<firstName<< " is the same as "<<newFirst<<endl;
}
Works fine for me. The only thing I noticed is on line 36 in your implementation file you forgot the reference so it doesn't match the prototype. string personType::isFirstEqual(string &nweFirst).
I uninstalled and re-installed codeblocks...still crashed. I decided to just keep going before I was out of time to finish my assignment and now the crashing seems to have gone away. weird lol