diff options
| author | Connor McDowell <[email protected]> | 2024-03-08 12:36:58 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-03-08 12:36:58 -0800 |
| commit | 0da86e742fa41643aff752c1f434cb191036463a (patch) | |
| tree | cdbdcc91d900921829fd7a9dcdb48121b21c2c1f /Project1/Contacts.h | |
| parent | proper char outputs. however each added contact is overwriting (saved to same... (diff) | |
| download | homework-7-connormcdowell275-0da86e742fa41643aff752c1f434cb191036463a.tar.xz homework-7-connormcdowell275-0da86e742fa41643aff752c1f434cb191036463a.zip | |
refactored with strings instead of char arrays
Diffstat (limited to 'Project1/Contacts.h')
| -rw-r--r-- | Project1/Contacts.h | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/Project1/Contacts.h b/Project1/Contacts.h index be81523..48a89c3 100644 --- a/Project1/Contacts.h +++ b/Project1/Contacts.h @@ -1,7 +1,8 @@ #ifndef CONTACTS_HEADER_H #define CONTACTS_HEADER_H - +#include <iostream> +using namespace std; // functions @@ -16,26 +17,26 @@ public: contact(contact&& move); contact& operator=(contact&& rhs);*/ - const char* Get_firstName(); - void Set_firstName(char* firstName); + string Get_firstName(); + void Set_firstName(string firstName); - const char* Get_lastName(); - void Set_lastName(char* lastName); + string Get_lastName(); + void Set_lastName(string lastName); - const char* Get_streetAddress(); - void Set_streetAddress(char* streetAddress); + string Get_streetAddress(); + void Set_streetAddress(string streetAddress); - const char* Get_city(); - void Set_city(char* city); + string Get_city(); + void Set_city(string city); - const char* Get_state(); - void Set_state(char* state); + string Get_state(); + void Set_state(string state); int Get_zip(); void Set_zip(int zip); - const char* Get_email(); - void Set_email(char* email); + string Get_email(); + void Set_email(string email); size_t Get_a(); void Set_a(size_t a); @@ -49,31 +50,31 @@ private: size_t _a = 0; // _a functions as delete bool. if a = 1, the slot is overwritten int _id; - char* _firstName{ }; - char* _lastName{ }; - char* _streetAddress{ }; - char* _city{ }; - char* _state{ }; + string _firstName; + string _lastName; + string _streetAddress; + string _city; + string _state; int _zip; - char* _email{ }; + string _email; }; struct contact_struct { - int a = 0; + int a = 0; //size_t id = contact_list::get_length; - int id = 0; - size_t count = 0; - char firstName[30]; - char lastName[30]; - char Email[105]; - char StreetAddress[45]; - char City[35]; - char State[4]; - int Zip = 0; - //contact() : a(true), id(0), count(0), Zip(0) {} + int id = 0; + size_t count = 0; + string firstName; + string lastName; + string Email; + string StreetAddress; + string City; + string State; + int Zip = 0; + //contact() : a(true), id(0), count(0), Zip(0) {} }; //struct contact |