refactoring
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
std::vector<std::string> splitString(const std::string &str) {
|
||||
std::istringstream iss(str);
|
||||
std::vector<std::string> words;
|
||||
std::string word;
|
||||
|
||||
while (iss >> word) {
|
||||
words.push_back(word);
|
||||
}
|
||||
|
||||
return words;
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::ifstream inputfile("input");
|
||||
std::string input;
|
||||
|
||||
int res = 0;
|
||||
if (!inputfile.is_open()) {
|
||||
std::cerr << "Could not open the file" << std::endl;
|
||||
return ENOENT;
|
||||
}
|
||||
std::string line;
|
||||
std::vector<std::string> lineSplited;
|
||||
int EqRes;
|
||||
|
||||
while (std::getline(inputfile, line)) {
|
||||
lineSplited = splitString(line);
|
||||
sscanf(lineSplited[0].c_str(), "%d:", &EqRes);
|
||||
lineSplited.erase(lineSplited.begin());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user