All pastes #204363 Raw Edit

Stuff

public cpp v1 · immutable
#204363 ·published 2006-10-15 22:02 UTC
rendered paste body
#include <iostream>#include <string.h>#include <ctype.h>using namespace std;//&#1103; &#1092;&#1080;&#1075;&#1077;&#1102; &#1089; &#1090;&#1072;&#1082;&#1086;&#1081; &#1073;&#1077;&#1079;&#1075;&#1088;&#1072;&#1084;&#1086;&#1090;&#1085;&#1086;&#1089;&#1090;&#1080;class TRecord {		private :		    char *FirstName ;		    char *LastName ;		  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):FirstName(NULL), LastName(NULL), PhoneNum(NULL), Email(NULL){	        (*this) = copy ;}TRecord& TRecord::operator = (TRecord from) {        // &#1083;&#1091;&#1095;&#1096;&#1077; &#1080;&#1089;&#1087;&#1086;&#1083;&#1100;&#1079;&#1086;&#1074;&#1072;&#1090;&#1100; SetName... &#1040; &#1074; &#1085;&#1080;&#1093; &#1090;&#1086;, &#1095;&#1090;&#1086; &#1085;&#1080;&#1078;&#1077;        if(!FirstName) FirstName=new char[len];        else if(strlen(FirstName)<(len=strlen(from.Person.FirstName)) ) {           delete []FirstName; FirstName = new char[len];        }        /// &#1080; &#1090;.&#1076;.	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):FirstName(NULL), LastName(NULL), PhoneNum(NULL), Email(NULL) {	Person.FirstName = new char[32]; FirstName[0]=0;	Person.LastName = new char[32]; LastName[0]=0;	PhoneNum = new char[32]; PhoneNum[0]=0;	Email = new char[32];			Email[0]=0;}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;	}}