aboutsummaryrefslogtreecommitdiff
path: root/CST116F2021-Lab7
diff options
context:
space:
mode:
authorJordanHT-OIT <[email protected]>2021-11-13 09:46:30 -0800
committerJordanHT-OIT <[email protected]>2021-11-13 09:46:30 -0800
commit71adede8c55689081565269fe1ecd1a571306f50 (patch)
tree5d44c393931f51b68342dda1086bd5486c30ef52 /CST116F2021-Lab7
parentSecond code update (diff)
downloadcst116-lab7-jordanht-oit-master.tar.xz
cst116-lab7-jordanht-oit-master.zip
Added documentationHEADmaster
Diffstat (limited to 'CST116F2021-Lab7')
-rw-r--r--CST116F2021-Lab7/CONSOLE_OUTPUT_Harris-Toovy.txt342
-rw-r--r--CST116F2021-Lab7/CST116F2021-Lab7.cpp38
2 files changed, 344 insertions, 36 deletions
diff --git a/CST116F2021-Lab7/CONSOLE_OUTPUT_Harris-Toovy.txt b/CST116F2021-Lab7/CONSOLE_OUTPUT_Harris-Toovy.txt
new file mode 100644
index 0000000..c8c25d4
--- /dev/null
+++ b/CST116F2021-Lab7/CONSOLE_OUTPUT_Harris-Toovy.txt
@@ -0,0 +1,342 @@
+This file contains the test results for the main program.
+
+---[Test 1: Adding strings]---
+
+String playground MK1
+There are currently 0 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: Hello!
+There are currently 1 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: Testing Testing 123
+There are currently 2 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+5
+
+C:\Users\jorda\Source\Repos\cst116-lab7-JordanHT-OIT\Debug\CST116F2021-Lab7.exe (process 11996) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+
+---[Test 2: Adding & displaying strings]---
+
+String playground MK1
+There are currently 0 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: Testing 1 2 3
+There are currently 1 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: Hello world!
+There are currently 2 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: This is a test.
+There are currently 3 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+2
+
+1 - Testing 1 2 3
+2 - Hello world!
+3 - This is a test.
+
+There are currently 3 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+5
+
+C:\Users\jorda\Source\Repos\cst116-lab7-JordanHT-OIT\Debug\CST116F2021-Lab7.exe (process 8992) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+
+---[Test 3: Substring Finding 1]---
+
+String playground MK1
+There are currently 0 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: Hello!
+There are currently 1 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: This is a test.
+There are currently 2 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: Oxygen
+There are currently 3 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: CST116-01P
+There are currently 4 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+2
+
+1 - Hello!
+2 - This is a test.
+3 - Oxygen
+4 - CST116-01P
+
+There are currently 4 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+3
+Enter string to search: yge
+The string "yge" was found in srting "Oxygen" which is in position 3
+There are currently 4 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+3
+Enter string to search: is a
+The string "is a" was found in srting "This is a test." which is in position 2
+There are currently 4 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+5
+
+C:\Users\jorda\Source\Repos\cst116-lab7-JordanHT-OIT\Debug\CST116F2021-Lab7.exe (process 11148) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+
+---[Test 4: Substring Finding 2]---
+
+String playground MK1
+There are currently 0 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: The first line!
+There are currently 1 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: This is the second line
+There are currently 2 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: Testing this program uses a lot of console space.
+There are currently 3 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: Last line of the test
+There are currently 4 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+3
+Enter string to search: ace
+The string "ace" was found in srting "Testing this program uses a lot of console space." which is in position 3
+There are currently 4 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+3
+Enter string to search: Last
+The string "Last" was found in srting "Last line of the test" which is in position 4
+There are currently 4 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+3
+Enter string to search: Not here
+No match found
+There are currently 4 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+5
+
+C:\Users\jorda\Source\Repos\cst116-lab7-JordanHT-OIT\Debug\CST116F2021-Lab7.exe (process 3316) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
+
+
+
+---[Test 5: Deleting strings]---
+
+String playground MK1
+There are currently 0 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: This is the first line
+There are currently 1 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: This is the second line
+There are currently 2 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: This is the third line
+There are currently 3 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+1
+Enter string: This is the last line
+There are currently 4 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+2
+
+1 - This is the first line
+2 - This is the second line
+3 - This is the third line
+4 - This is the last line
+
+There are currently 4 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+4
+Select a string to remove: 4
+There are currently 3 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+2
+
+1 - This is the first line
+2 - This is the second line
+3 - This is the third line
+
+There are currently 3 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+4
+Select a string to remove: 2
+There are currently 2 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+2
+
+1 - This is the first line
+2 - This is the third line
+
+There are currently 2 strings in the array.
+1) Add a string
+2) Print current strings
+3) Search for a substring
+4) Delete a string
+5) Exit
+5
+
+C:\Users\jorda\Source\Repos\cst116-lab7-JordanHT-OIT\Debug\CST116F2021-Lab7.exe (process 1324) exited with code 0.
+To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
+Press any key to close this window . . .
diff --git a/CST116F2021-Lab7/CST116F2021-Lab7.cpp b/CST116F2021-Lab7/CST116F2021-Lab7.cpp
index 72024a0..aef1f64 100644
--- a/CST116F2021-Lab7/CST116F2021-Lab7.cpp
+++ b/CST116F2021-Lab7/CST116F2021-Lab7.cpp
@@ -8,40 +8,6 @@
using namespace std;
-//From class: Substring finding code REMOVE BEFORE SENDING THIS IN
-/*
-#define ARRAY_SIZE 100
-
-int main()
-{
- string testArray[ARRAY_SIZE]{ "Test1", "Test2", "Hello all" };
- string subSring{ "ll" };
- int i = 0, j = 0, k = 0;
-
- while ((subSring[i] != testArray[2][j]) && (j < testArray[2].size()))
- {
- j++;
- }
- if (subSring[i] == testArray[2][j])
- {
- while ((subSring[i]) == testArray[2][j] && (i < subSring.size()) && (j < testArray[2].size()))
- {
- i++;
- j++;
- }
- }
- if (i == subSring.size())
- {
- cout << "Substring " << subSring << " was found,";
- }
- else
- {
- cout << "Substring " << subSring << " was not found,";
- }
- return (0);
-}
-*/
-
#define MAX_STRINGS 100
//Do not exceed 999; the output will become unevenly spaced
@@ -57,6 +23,8 @@ int main(void)
string strArray[MAX_STRINGS]{}, searchString{};
int occupiedPositions = 0, menuSelect = 1, searchTarget = 0;
+ cout << "String playground MK1" << endl;
+
while ((menuSelect >= 1) && (menuSelect <= 4))
{
menuSelect = menu(occupiedPositions);
@@ -107,8 +75,6 @@ int main(void)
}
}
- cout << endl << "Exiting" << endl;
-
return (0);
}