rendered paste body#include <iostream>
#include <string.h>
#include <ctype.h>
using namespace std;
class TRecord {
private :
struct {
char *FirstName ;
char *LastName ;
}
Person ;
char *PhoneNum ;
char *Email ;
public :
TRecord (void) ;
TRecord (TRecord& copy) ;
TRecord (char *firstname, char *lastname, char *phonenum, char *email) ;
~TRecord (void) ;
int SetFirstName (char *firstname) ;
int SetLastName (char *lastname) ;
int SetName (char *firstname, char *lastname) ;
int SetPhoneNum (char *phonenum) ;
int SetEmail (char *email) ;
char *GetFirstName (void) ;
char *GetLastName (void) ;
char *GetName (void) ;
char *GetPhoneNum (void) ;
char *GetEmail (void) ;
bool operator <= (TRecord X) ;
TRecord& operator = (TRecord from) ;
int ABC (char *string) ;
int strcomp (char *A, char *B) ;
} ;
TRecord::TRecord(TRecord& copy) {
(*this) = copy ;
}
TRecord& TRecord::operator = (TRecord from) {
strcpy (this->Person.FirstName, from.Person.FirstName) ;
strcpy (this->Person.LastName, from.Person.LastName) ;
strcpy (this->PhoneNum, from.PhoneNum) ;
strcpy (this->Email, from.Email) ;
return *this ;
}
TRecord::TRecord (void) {
if (Person.FirstName) { delete[] Person.FirstName ;
Person.FirstName = NULL ;
}
if (Person.LastName) { delete[] Person.LastName ;
Person.LastName = NULL ;
}
if (PhoneNum) { delete[] PhoneNum ;
PhoneNum = NULL ;
}
if (Email) { delete[] Email ;
Email = NULL ;
}
Person.FirstName = new char[32]; strcpy (Person.FirstName, "") ;
Person.LastName = new char[32]; strcpy (Person.LastName, "") ;
PhoneNum = new char[32]; strcpy (PhoneNum, "") ;
Email = new char[32]; strcpy (Email, "") ;
}
TRecord::TRecord (char *firstname, char *lastname, char *phonenum, char *email) {
SetName (firstname, lastname) ;
SetPhoneNum (phonenum) ;
SetEmail (email) ;
}
TRecord::~TRecord (void) {
if (Person.FirstName) { delete[] Person.FirstName ;
Person.FirstName = NULL;
}
if (Person.LastName) { delete[] Person.LastName ;
Person.LastName = NULL;
}
if (PhoneNum) { delete[] PhoneNum ;
PhoneNum = NULL;
}
if (Email) { delete[] Email ;
Email = NULL;
}
}