From f6ef79fae2201c6d5b47b32ab5e4962345e7ea42 Mon Sep 17 00:00:00 2001 From: Tyler Taormina Date: Sun, 14 Nov 2021 22:02:06 -0800 Subject: Complete Lab --- num2.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'num2.cpp') diff --git a/num2.cpp b/num2.cpp index 9470670..1ee21b2 100644 --- a/num2.cpp +++ b/num2.cpp @@ -130,7 +130,9 @@ void RmString(string arr[], int limit) // May need to use vector. int i = 0, j = 0, k = 0; int choice; + string deleted; string copy[max]; + cout << "What data entry would you like to delete..." << endl; PrintString(limit, arr); cout << "Please enter the number for the string that you'd like to delte: " << endl; @@ -142,28 +144,28 @@ void RmString(string arr[], int limit) { if (k == choice) { cout << "Deleting...\n\n" << endl; + deleted = arr[k]; k++; + j--; + } else { copy[j] = arr[k]; k++; } - - } - cout << "==================================================================\n"; cout << "Here is our updated database..." << endl; cout << "==================================================================\n"; - while (i < limit) + while (i < (limit - 1)) { cout << i+1 << ") " << copy[i] << endl; i++; } - + cout << "We removed: " << deleted << endl; } -- cgit v1.2.3