aboutsummaryrefslogtreecommitdiff
path: root/num2.cpp
diff options
context:
space:
mode:
authorTyler Taormina <[email protected]>2021-11-14 22:02:06 -0800
committerTyler Taormina <[email protected]>2021-11-14 22:02:06 -0800
commitf6ef79fae2201c6d5b47b32ab5e4962345e7ea42 (patch)
tree7354af09f8c83ca24edcde67abc7f74f8d4785aa /num2.cpp
parentLab complete (diff)
downloadcst116-lab7-till-t-f6ef79fae2201c6d5b47b32ab5e4962345e7ea42.tar.xz
cst116-lab7-till-t-f6ef79fae2201c6d5b47b32ab5e4962345e7ea42.zip
Complete Lab
Diffstat (limited to 'num2.cpp')
-rw-r--r--num2.cpp12
1 files changed, 7 insertions, 5 deletions
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;
}