Hey, I need help getting this program to run.
This is what I'm trying to do.
a) set and store the first name only
b) set and store the last name only
c) store and set the middle name
d) check to see if a given first name is the same as the first person already entered
e) check to see if a given last name is te same as the last person already entered
My main goal right now, is to get my program up and running, so I can enter in the first, middle, and last name. Thank you. My code is below.
.cpp
#include <iostream>
using namespace std;
#include "Unknown.h"
int main()
{
personType first("Unknown");
first.print();
personType middle;
middle.print();
personType last;
last.print();
firstperson.checkfirst("James");
lastperson.checkfirst("Berry");
cout<<"What is the first name of person"<<endl;
first;
if (Student1.checkfirst(first))
{
cout<<"The first is not the same"<<endl;
}
if (Student1.checkfirst(last))
{
cout<<"The last is not the same"<<endl;
}
system ("PAUSE");
return 0;
}
.h file
class personType
{
public:
void print()const;
void setName(string first, string middle, string last);
string getFirstName()const;
string getLastName()const;
string getMiddleName()const;
personType::personType();
bool personType::checkfirst(string first);
private:
string firstname;
string lastname;
string middlename;
};
void personType::print()const
{
cout<<firstname<<" "<<middlename<<" "<<lastname;
}
void personType::setName(string first, string last, string middle)
{
firstname = first;
lastname = last;
middlename = middle;
}
personType::personType()
{
firstname = "Unknown";
middlename = "Unknown";
lastname = "Unknown";
}
string personType::getFirstName()const
{
string firstname;
cout<<"What is your first name"<<endl;
cin>>firstname;
return firstname;
}
string getmiddleName()const
{
string middlename;
cout<<"What is your middle name"<<endl;
cin>>middlename;
return middlename;
}
string personType::getLastName()const
{
string lastname;
cout<<"What is your last name"<<endl;
cin>>lastname;
return lastname;
}
bool personType::checkfirst(string first)
{
}