Skip to content

Commit cbef9d6

Browse files
committed
fixes
1 parent a386b20 commit cbef9d6

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

CMP201StringSearch/CMP201StringSearch.cpp

+6-16
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ enum class MessageType {
3535
BoyerMoore
3636
};
3737

38+
/// <summary>
39+
/// Clears the console screen and outputs the relevant header
40+
/// </summary>
41+
/// <param name="message">The header header to print</param>
3842
void Clear(MessageType message)
3943
{
4044
#if defined _WIN32
@@ -70,29 +74,13 @@ void Clear(MessageType message)
7074
}
7175
}
7276

73-
std::string GetFileText(const std::string& fileToRead) {
74-
// read text file
75-
// file to read from
76-
std::ifstream file(fileToRead);
77-
// temp line storage
78-
std::string line;
79-
// output text storage
80-
std::string output;
81-
// loop through each line and append the line to the string
82-
while (std::getline(file, line)) output.append(line);
83-
// while (file >> line) output.append(line);
84-
// return the contents of the file
85-
return output;
86-
}
87-
8877
std::string GetText() {
8978
//// get text file
9079
std::string input;
9180
do {
9281
std::cout << "USE ASCII CHARACTERS ONLY\nYOU HAVE BEEN WARNED\nEnter y when the text you want to search is in a text file named \"search.txt\" in the same folder as this .exe\n";
9382
std::getline(std::cin, input);
9483
} while (input[0] != 'y');
95-
//return GetFileText("search.txt");
9684
std::cout << "\nReading file...\n";
9785
load_file("search.txt", input);
9886
return input;
@@ -148,6 +136,8 @@ void StoreTimeTaken(size_t sampleSize, size_t patternLength, size_t sampleIterat
148136
case 2:
149137
output.append(",7,");
150138
break;
139+
default:
140+
exit(1);
151141
}
152142
// current iteration out
153143
output.append(std::to_string(sampleIteration) + ",");

0 commit comments

Comments
 (0)