diff options
Diffstat (limited to 'Project1/contacts.cpp')
| -rw-r--r-- | Project1/contacts.cpp | 112 |
1 files changed, 53 insertions, 59 deletions
diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp index 2fec269..20da12d 100644 --- a/Project1/contacts.cpp +++ b/Project1/contacts.cpp @@ -190,7 +190,7 @@ void addContact(contact newContact, size_t MAX, contact_list contacts[]) } } -void contact_list::AddContact(contact& Contact, size_t& t) +void contact_list::AddContact(contact contact[], size_t& t, contact_struct save) { //CURRENTLY TESTING for (size_t i = 0; i < size_, i++;) @@ -207,84 +207,77 @@ void contact_list::AddContact(contact& Contact, size_t& t) i = i + 1; } } - char firstName[30]; - char lastName[30]; - char Email[105]; - char StreetAddress[45]; - char City[35]; - char State[4]; - int Zip = 0; - contacts_[i].Set_id(i); - //contacts_[i].Set_a(t); - cin.ignore(1000, '\n'); - cout << "Please enter each piece of information when you are prompted to" << endl; - cout << "enter first name: " << endl; - cin >> firstName; - contacts_[i].Set_firstName(firstName); - cout << "enter last name: " << endl; - cin >> lastName; - contacts_[i].Set_lastName(lastName); - cout << "enter Email: " << endl; - cin >> Email; - contacts_[i].Set_email(Email); - cout << "enter Street Address: " << endl; - cin >> StreetAddress; - contacts_[i].Set_streetAddress(StreetAddress); - cout << "enter city: " << endl; - cin >> City; - contacts_[i].Set_city(City); - cout << "enter State as two letter abbreviation: " << endl; - cin >> State; - contacts_[i].Set_state(State); - cout << "Please enter the next value as a series of numbers" << endl; - cout << "enter Zip: " << endl; - cin >> Zip; - contacts_[i].Set_zip(Zip); - contacts_[size_++] = Contact; + //char firstName[30]; + //char lastName[30]; + //char Email[105]; + //char StreetAddress[45]; + //char City[35]; + //char State[4]; + //int Zip = 0; + //contacts_[i].Set_id(i); + ////contacts_[i].Set_a(t); + //cin.ignore(1000, '\n'); + //cout << "Please enter each piece of information when you are prompted to" << endl; + //cout << "enter first name: " << endl; + //cin >> firstName; + //contacts_[i].Set_firstName(firstName); + //cout << "enter last name: " << endl; + //cin >> lastName; + //contacts_[i].Set_lastName(lastName); + //cout << "enter Email: " << endl; + //cin >> Email; + //contacts_[i].Set_email(Email); + //cout << "enter Street Address: " << endl; + //cin >> StreetAddress; + //contacts_[i].Set_streetAddress(StreetAddress); + //cout << "enter city: " << endl; + //cin >> City; + //contacts_[i].Set_city(City); + //cout << "enter State as two letter abbreviation: " << endl; + //cin >> State; + //contacts_[i].Set_state(State); + //cout << "Please enter the next value as a series of numbers" << endl; + //cout << "enter Zip: " << endl; + //cin >> Zip; + //contacts_[i].Set_zip(Zip); + // contacts_[size_++] = Contact; break; } } - for (size_t i = t; i < size_; i++) + for (size_t i = t; i < size_;) { - char firstName[30]{ }; - char lastName[30]{ }; - char Email[105]{ }; - char StreetAddress[45]{ }; - char City[35]{ }; - char State[4]{ }; - int Zip = 0; contacts_[i].Set_a(0); contacts_[i].Set_id(i); //newContact[i].count = t; cin.ignore(1000, '\n'); cout << "Please enter each piece of information when you are prompted to" << endl; cout << "enter first name: " << endl; - cin >> firstName; - contacts_[i].Set_firstName(firstName); + cin >> save.firstName; + contacts_[i].Set_firstName(save.firstName); cout << "enter last name: " << endl; - cin >> lastName; - contacts_[i].Set_lastName(lastName); + cin >> save.lastName; + contacts_[i].Set_lastName(save.lastName); cout << "enter Email: " << endl; - cin >> Email; - contacts_[i].Set_email(Email); + cin >> save.Email; + contacts_[i].Set_email(save.Email); cout << "enter Street Address: " << endl; - cin >> StreetAddress; - contacts_[i].Set_streetAddress(StreetAddress); + cin >> save.StreetAddress; + contacts_[i].Set_streetAddress(save.StreetAddress); cout << "enter city: " << endl; - cin >> City; - contacts_[i].Set_city(City); + cin >> save.City; + contacts_[i].Set_city(save.City); cout << "enter State as two letter abbreviation: " << endl; - cin >> State; - contacts_[i].Set_state(State); + cin >> save.State; + contacts_[i].Set_state(save.State); cout << "Please enter the next value as a series of numbers" << endl; cout << "enter Zip: " << endl; - cin >> Zip; - contacts_[i].Set_zip(Zip); - t++; + cin >> save.Zip; + contacts_[i].Set_zip(save.Zip); /* size_t id = i; contacts_[i].Set_id(id);*/ //contacts_[size_++] = Contact; + contacts_[i].Get_firstName(); break; } @@ -369,6 +362,7 @@ void contact_list::Print() const cout << "City: " << contacts_[i].Get_city() << endl; cout << "State: " << contacts_[i].Get_state() << endl; cout << "Zip code: " << contacts_[i].Get_zip() << endl; + //contacts_[i].print; } } @@ -424,7 +418,7 @@ size_t max_double(size_t MAX) return MAX; } -void contact_list::DeleteContact(contact& contact) +void contact_list::DeleteContact(contact* contact[]) { //Work in progress, add BOOL (true) to struct, when this is selected print id list with respective names //then take input of id list number and set bool to false |