days 1-5
This commit is contained in:
@@ -1,6 +1,23 @@
|
||||
#include "boilerplate.hh"
|
||||
|
||||
// newline separated split
|
||||
// newline separated split, int
|
||||
std::vector<int> readFileInt(std::string file){
|
||||
std::vector<int> outputVec;
|
||||
|
||||
std::ifstream inputFile(file);
|
||||
if (!inputFile.is_open()){
|
||||
std::cerr << "File " << file << "not found";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
std::string line;
|
||||
while(getline(inputFile, line)){
|
||||
outputVec.push_back(stoi(line));
|
||||
}
|
||||
return outputVec;
|
||||
}
|
||||
|
||||
// newline separated split, string
|
||||
std::vector<std::string> readFile(std::string file){
|
||||
std::vector<std::string> outputVec;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
using InputArrays = std::vector<std::vector<std::string>>;
|
||||
|
||||
InputArrays readFile(std::string, char);
|
||||
std::vector<int> readFileInt(std::string);
|
||||
std::vector<std::string> readFile(std::string);
|
||||
std::vector<std::string> ssplit(std::string, char);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user