Update MP2
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user