aboutsummaryrefslogtreecommitdiff
path: root/Project1/contacts.cpp
diff options
context:
space:
mode:
authorConnor McDowell <[email protected]>2024-02-18 16:08:27 -0800
committerConnor McDowell <[email protected]>2024-02-18 16:08:27 -0800
commit7addf3cf043f1fc00fd8a641ccf65aa13b2fef47 (patch)
tree225a16ff4f875ea4ae796e44a093dd895b39b11e /Project1/contacts.cpp
parentits fixed ???? testing (diff)
downloadhomework-5-connormcdowell275-7addf3cf043f1fc00fd8a641ccf65aa13b2fef47.tar.xz
homework-5-connormcdowell275-7addf3cf043f1fc00fd8a641ccf65aa13b2fef47.zip
got moving through the list working, but now print is broken;
Diffstat (limited to 'Project1/contacts.cpp')
-rw-r--r--Project1/contacts.cpp58
1 files changed, 31 insertions, 27 deletions
diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp
index dbb5a23..99db58d 100644
--- a/Project1/contacts.cpp
+++ b/Project1/contacts.cpp
@@ -22,34 +22,27 @@ int menu()
return c;
}
-char addNew(contact newContact[], size_t MAX)
+char addNew(contact newContact[], size_t MAX, int t)
{
-
- int i = 0;
- int c = 0;
- cin >> c;
- if (c == 1)
+ for (int i = t; i < MAX; i++)
{
- cout << "works!" << endl;
- for (int i = 0; i < MAX; i++)
- {
- newContact[i].id = i + 1;
- cout << "enter name: " << endl;
- cin >> newContact[i].Name;
- cout << "enter Email: " << endl;
- cin >> newContact[i].Email;
- cout << "enter Street Address: " << endl;
- cin >> newContact[i].StreetAddress;
- cout << "enter city: " << endl;
- cin >> newContact[i].City;
- cout << "enter State: " << endl;
- cin >> newContact[i].State;
- cout << "enter Zip: " << endl;
- cin >> newContact[i].Zip;
- 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;
+ newContact[i].id = i + 1;
+ cout << "enter name: " << endl;
+ cin >> newContact[i].Name;
+ cout << "enter Email: " << endl;
+ cin >> newContact[i].Email;
+ cout << "enter Street Address: " << endl;
+ cin >> newContact[i].StreetAddress;
+ cout << "enter city: " << endl;
+ cin >> newContact[i].City;
+ cout << "enter State: " << endl;
+ cin >> newContact[i].State;
+ cout << "enter Zip: " << endl;
+ cin >> newContact[i].Zip;
+ 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;
return 0;
}
// print contact i
@@ -92,12 +85,23 @@ void printAll(contact newContact[], size_t MAX)
{
for (int i = 0; i < MAX; ++i)
{
- cout << newContact[i].id << endl;
+ /*for (int t = -1; t < newContact[i].id;) {
+ break;
+ }*/
+ if (newContact[i].id < 0) {
+ if (newContact[i].id >= MAX){
+ if (newContact[i].id == 0) {
+ break;
+ }
+ }
+ }
+ cout << "List number: " << newContact[i].id << endl;
cout << "name: " << newContact[i].Name << endl;
cout << "Email: " << newContact[i].Email << endl;
cout << "Address: " << newContact[i].StreetAddress << endl;
- cout << "city" << newContact[i].City << endl;
+ cout << "city: " << newContact[i].City << endl;
cout << "state: " << newContact[i].State << endl;
cout << "Zip: " << newContact[i].Zip << endl;
+
}
}