From 1bacd198368da82c8d1041ada746a2bf7df52898 Mon Sep 17 00:00:00 2001 From: Connor McDowell Date: Sun, 18 Feb 2024 16:16:01 -0800 Subject: print fixed --- Project1/contacts.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp index 99db58d..f4a89aa 100644 --- a/Project1/contacts.cpp +++ b/Project1/contacts.cpp @@ -88,13 +88,16 @@ void printAll(contact newContact[], size_t MAX) /*for (int t = -1; t < newContact[i].id;) { break; }*/ + if (newContact[i].id == 0) { + break; + } if (newContact[i].id < 0) { - if (newContact[i].id >= MAX){ - if (newContact[i].id == 0) { - break; - } - } + break; } + if (newContact[i].id > MAX) { + break; + } + cout << "List number: " << newContact[i].id << endl; cout << "name: " << newContact[i].Name << endl; cout << "Email: " << newContact[i].Email << endl; @@ -102,6 +105,5 @@ void printAll(contact newContact[], size_t MAX) cout << "city: " << newContact[i].City << endl; cout << "state: " << newContact[i].State << endl; cout << "Zip: " << newContact[i].Zip << endl; - } } -- cgit v1.2.3