From 599c5b9fddb1fdf72946379ea345977778e7753b Mon Sep 17 00:00:00 2001 From: Connor McDowell Date: Mon, 19 Feb 2024 19:55:46 -0800 Subject: i love it when i have a fuckin workin program but then oooo you have to double it and nOTHING WORKS anymore. ive been doin this shit all fuckin weekend i havent seen the sun in days. --- Project1/contacts.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'Project1/contacts.cpp') diff --git a/Project1/contacts.cpp b/Project1/contacts.cpp index 4f2ec9e..ee1641d 100644 --- a/Project1/contacts.cpp +++ b/Project1/contacts.cpp @@ -24,10 +24,11 @@ int menu() char addNew(contact newContact[], size_t MAX, size_t t) { - for (size_t i = t; i < MAX; i++) + size_t a = t - 1; + for (size_t i = a ;; i++) { - newContact[i].id = i + 1; - newContact[i].count = t; + newContact[i].id = i; + newContact[i].count = a - 1; cin.ignore(1000, '\n'); cout << "Please enter each piece of information when you are prompted to" << endl; cout << "enter name: " << endl; @@ -85,22 +86,22 @@ void update(struct contact newContact[], size_t MAX) } } -void printAll(contact newContact[], size_t MAX) +void printAll(contact newContact[], size_t MAX, size_t Cont_list_lenth) { - for (int i = 0; i < MAX; ++i) + for (size_t i = 0; i < Cont_list_lenth; ++i) { /*for (int t = -1; t < newContact[i].id;) { break; }*/ - if (newContact[i].id == 0) { + /*if (newContact[i].id == 0) { break; - } + }*/ if (newContact[i].id < 0) { break; } - if (newContact[i].id > MAX) { - break; - } + //if (newContact[i].id > Cont_list_lenth) { + // break; + //} cout << "List number: " << newContact[i].id << endl; cout << "name: " << newContact[i].Name << endl; -- cgit v1.2.3