Update MP2

This commit is contained in:
2024-03-08 09:15:43 -06:00
parent f0616ed75b
commit 9bbae8730d
23 changed files with 2742 additions and 198 deletions

View File

@@ -9,10 +9,10 @@
#include <cstdlib>
#include <map>
#include <algorithm>
#include "colormap.h"
using namespace std::literals::string_literals; // import std::string literals
#include "binarySearch.h"
#include "colormap.h"
class OutOfBoundsException: public std::exception {
virtual const char* what() const throw()
@@ -148,11 +148,13 @@ std::string printVector(std::vector<int> arr, std::vector<int> locationVector =
if (binarySearch(locationVector, i) == i) {
output.append(colorIterator());
}
output.append(COLOR_WHITE);
output.append(std::to_string(arr[i]));
if ((arr.size() - 1) > i) {
output.append(", ");
}
if (binarySearch(locationVector, i) == i) {
output.append(COLOR_WHITE.c_str());
}
}
output.append("}");
return output;
@@ -184,4 +186,4 @@ std::vector<std::vector<int>> random2DArray(int x, int y) {
}
}
return array;
}
}