diff options
Diffstat (limited to 'Project1/contacts.cpp')
| -rw-r--r-- | Project1/contacts.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp index 0dcead9..f40e7f2 100644 --- a/Project1/contacts.cpp +++ b/Project1/contacts.cpp @@ -22,12 +22,13 @@ int menu() return c; } -char addNew(contact newContact[], size_t MAX, int t) +char addNew(contact newContact[], size_t MAX, size_t t) { for (int i = t; i < MAX; i++) { newContact[i].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 name: " << endl; cin.getline(newContact[i].Name, 25); @@ -38,7 +39,7 @@ char addNew(contact newContact[], size_t MAX, int t) cout << "enter city: " << endl; cin.getline(newContact[i].City, 30); cout << "enter State as two letter abbreviation: " << endl; - cin.getline(newContact[i].Name, 5); + cin.getline(newContact[i].State, 3); cout << "Please enter the next value as a series of numbers" << endl; cout << "enter Zip: " << endl; cin >> newContact[i].Zip; @@ -64,6 +65,7 @@ void update(struct contact newContact[], size_t MAX) int t = c - 1; for (int i = t; i < MAX;) { + cin.ignore(1000, '\n'); cout << "Please enter each piece of information when you are prompted to" << endl; newContact[i].id = c; cout << "enter name: " << endl; @@ -75,7 +77,7 @@ void update(struct contact newContact[], size_t MAX) cout << "enter city: " << endl; cin.getline(newContact[i].City, 30); cout << "enter State as two letter abbreviation: " << endl; - cin.getline(newContact[i].Name, 5); + cin.getline(newContact[i].State, 3); cout << "Please enter the next value as a series of numbers" << endl; cout << "enter Zip: " << endl; cin >> newContact[i].Zip; @@ -110,15 +112,15 @@ void printAll(contact newContact[], size_t MAX) } } -//char contact_double(contact*& newContact, size_t MAX, int t) -//{ -// contact* doubleContact = new contact[MAX * 2]; -// -// for (newContact[t].count = t; t < MAX * 2;) -// { -// doubleContact[t] = newContact[t]; -// } -// delete[] newContact; -// newContact = doubleContact; -// return newContact; -//}
\ No newline at end of file +char contact_double(contact*& newContact, size_t MAX, size_t t) +{ + contact* doubleContact = new contact[MAX * 2]; + + for (newContact[t].count = t; t < MAX * 2;) + { + doubleContact[t] = newContact[t]; + } + delete[] newContact; + newContact = doubleContact; + +}
\ No newline at end of file |