diff options
| -rw-r--r-- | Project1/contact.cpp | 33 | ||||
| -rw-r--r-- | Project1/contact.h | 26 | ||||
| -rw-r--r-- | Project1/main.cpp | 11 |
3 files changed, 42 insertions, 28 deletions
diff --git a/Project1/contact.cpp b/Project1/contact.cpp index b195609..cfbbb47 100644 --- a/Project1/contact.cpp +++ b/Project1/contact.cpp @@ -7,9 +7,9 @@ using std::endl; -void contact::Set_firstName(char firstName) +void contact::Set_firstName(const char* firstName) { - *_firstName = firstName; + *_firstName = *firstName; } char* contact::Get_firstName() @@ -17,9 +17,9 @@ char* contact::Get_firstName() return _firstName; } -void contact::Set_lastName(char lastName) +void contact::Set_lastName(const char* lastName) { - *_lastName = lastName; + *_lastName = *lastName; } char* contact::Get_lastName() @@ -27,9 +27,9 @@ char* contact::Get_lastName() return _lastName; } -void contact::Set_streetAddress(char streetAddress) +void contact::Set_streetAddress(const char* streetAddress) { - *_streetAddress = streetAddress; + *_streetAddress = *streetAddress; } char* contact::Get_streetAddress() @@ -37,9 +37,9 @@ char* contact::Get_streetAddress() return _streetAddress; } -void contact::Set_city(char city) +void contact::Set_city(const char* city) { - *_city = city; + *_city = *city; } char* contact::Get_city() @@ -47,7 +47,18 @@ char* contact::Get_city() return _city; } -int contact::Set_zip(int zip) +void contact::Set_state(const char* state) +{ + *_state = *state; +} + +char* contact::Get_state() +{ + return _state; +} + + +void contact::Set_zip(int zip) { _zip = zip; } @@ -57,9 +68,9 @@ int contact::Get_zip() return _zip; } -void contact::Set_email(char email) +void contact::Set_email(const char* email) { - *_email = email; + *_email = *email; } char* contact::Get_email() diff --git a/Project1/contact.h b/Project1/contact.h index 02d6b85..7ffec87 100644 --- a/Project1/contact.h +++ b/Project1/contact.h @@ -7,36 +7,36 @@ public: contact() = default; char* Get_firstName(); - void Set_firstName(char firstName); + void Set_firstName(const char* firstName); char* Get_lastName(); - void Set_lastName(char lastName); + void Set_lastName(const char* lastName); char* Get_streetAddress(); - void Set_streetAddress(char streetAddress); + void Set_streetAddress(const char* streetAddress); char* Get_city(); - void Set_city(char city); + void Set_city(const char* city); char* Get_state(); - void Set_state(char state); + void Set_state(const char* state); int Get_zip(); - int Set_zip(int zip); + void Set_zip(int zip); char* Get_email(); - void Set_email(char email); + void Set_email(const char* email); void print(); private: - char* _firstName{}; - char* _lastName{}; - char* _streetAddress{}; - char* _city{}; - char* _state{}; + char* _firstName{ }; + char* _lastName{ }; + char* _streetAddress{ }; + char* _city{ }; + char* _state{ }; int _zip; - char* _email{}; + char* _email{ }; }; diff --git a/Project1/main.cpp b/Project1/main.cpp index 85da978..6d29960 100644 --- a/Project1/main.cpp +++ b/Project1/main.cpp @@ -15,10 +15,13 @@ int main() { contact newContact; - //cout << newContact.GetAge(); - - //newContact.SetAge(42); - //newContact + newContact.Set_firstName("Connor"); + newContact.Set_lastName("McDowell"); + newContact.Set_streetAddress("6051 Lakeview Blvd"); + newContact.Set_city("Lake Oswego"); + newContact.Set_state("Oregon"); + newContact.Set_zip(97035); + newContact.Set_email("[email protected]"); newContact.print(); |