diff options
| author | Connor McDowell <[email protected]> | 2024-03-03 16:24:05 -0800 |
|---|---|---|
| committer | Connor McDowell <[email protected]> | 2024-03-03 16:24:05 -0800 |
| commit | 925b2b8caf76e2a33e04bfa5bfdf1813dbde71f9 (patch) | |
| tree | 2af028678eb084694e93b1c5ed452395c3f47586 /Project1 | |
| parent | first successful build (diff) | |
| download | homework-7-connormcdowell275-925b2b8caf76e2a33e04bfa5bfdf1813dbde71f9.tar.xz homework-7-connormcdowell275-925b2b8caf76e2a33e04bfa5bfdf1813dbde71f9.zip | |
print not working. or data not being saved in add new.
Diffstat (limited to 'Project1')
| -rw-r--r-- | Project1/contacts.cpp | 180 |
1 files changed, 88 insertions, 92 deletions
diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp index ee12f96..7374fdf 100644 --- a/Project1/contacts.cpp +++ b/Project1/contacts.cpp @@ -151,100 +151,96 @@ void contact_list::AddContact(const contact& contact) { contacts_[size_++] = contact; //CURRENTLY TESTING - for (size_t i = 0; i < size_, i++;) - { - size_t a = contacts_[i].Get_a(); - for (a = 1; ++i;) - { - contacts_[i].Set_a(0); - size_t temp = contacts_[i].Get_id(); - for (auto j = temp; j < size_; j++) - { - if (contacts_[i].Get_id() != 0) - { - 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); - break; - } - } - for (auto i = 0u; i < size_; i++) + //for (size_t i = 0; i < size_, i++;) + //{ + // size_t a = contacts_[i].Get_a(); + // for (a = 1; ++i;) + // { + // contacts_[i].Set_a(0); + // size_t temp = contacts_[i].Get_id(); + // for (auto j = temp; j < size_; j++) + // { + // if (contacts_[i].Get_id() != 0) + // { + // 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); + // break; + // } + //} + for (size_t i = 0; i < size_; i++) { - size_t t = contacts_[i].Get_id(); - for (size_t i = t; i < size_; i++) - { - 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 + 1); - //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); - 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); - t++; - break; - } + 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 + 1); + //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); + 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); + size_t id = i + 1; + contacts_[i].Set_id(id); + break; } - //cout << newContact[i]->Name << "\n" << newContact[i]->Email << "\n" << newContact[i]->StreetAddress << "\n" << newContact[i]->City << "\n" << newContact[i]->State << "\n" << newContact[i]->Zip << endl; |