diff --git a/CM2005 Object Oriented Programming/Topic 3/3.4.11/main.cpp b/CM2005 Object Oriented Programming/Topic 3/3.4.11/main.cpp index 8d3ac0c..364c0b4 100644 --- a/CM2005 Object Oriented Programming/Topic 3/3.4.11/main.cpp +++ b/CM2005 Object Oriented Programming/Topic 3/3.4.11/main.cpp @@ -9,48 +9,4 @@ int main() { MerkelMain app{}; app.init(); - - //CSVReader reader; - //CSVReader::readCSV("20200317.csv"); -} - - - - - - -// std::vector orders; - -// orders.push_back( OrderBookEntry{1000, -// 0.02, -// "2020/03/17 17:01:24.884492", -// "BTC/USDT", -// OrderBookType::bid} ); - -// orders.push_back( OrderBookEntry{2000, -// 0.02, -// "2020/03/17 17:01:24.884492", -// "BTC/USDT", -// OrderBookType::bid} ); - - -// // std::cout << "The price is " << orders[1].price << std::endl; - -// for (OrderBookEntry& order : orders) -// { -// std::cout << "The price is " << order.price << std::endl; -// } - -// for (unsigned int i = 0; i < orders.size() ; ++i) -// { -// std::cout << "The price is " << orders[i].price << std::endl; -// } - -// for (unsigned int i = 0; i < orders.size() ; ++i) -// { -// std::cout << "The price is " << orders.at(i).price << std::endl; -// } - - - - +} \ No newline at end of file diff --git a/CM2005 Object Oriented Programming/Topic 3/3.4.11/merklerex b/CM2005 Object Oriented Programming/Topic 3/3.4.11/merklerex deleted file mode 100644 index ec291e0..0000000 Binary files a/CM2005 Object Oriented Programming/Topic 3/3.4.11/merklerex and /dev/null differ diff --git a/CM2005 Object Oriented Programming/Topic 3/3.4.11/test.cpp b/CM2005 Object Oriented Programming/Topic 3/3.4.11/test.cpp deleted file mode 100644 index 7873fd2..0000000 --- a/CM2005 Object Oriented Programming/Topic 3/3.4.11/test.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include -#include -#include -#include - -std::vector Tokenise(std::string csvLine, char separator) -{ - std::vector tokens; - signed int start, end; - std::string token; - start = csvLine.find_first_not_of(separator, 0); - do - { - end = csvLine.find_first_of(separator, start); - if(start == csvLine.length() || start == end) break; - if(end >= 0) - token = csvLine.substr(start, end - start); - else - token = csvLine.substr(start, csvLine.length() - start); - - tokens.push_back(token); - start = end + 1; - } while (end > 0); - return tokens; -} - -int main() -{ - std::string filename = "20200317.csv"; - std::string line; - std::ifstream csvFile{filename}; - - std::vector tokens; - - if(csvFile.is_open()) - { - std::cout << "File open" << std::endl; - while(std::getline(csvFile, line)) - { - std::cout << "Read line: " << line << std::endl; - tokens = Tokenise(line, ','); - if(tokens.size() != 5) //bad - { - std::cout << "Bad line" << std::endl; - continue; - } - double price{}; - double amount{}; - // We checked and we have 5 tokens - try - { - price = std::stod(tokens[3]); - amount = std::stod(tokens[4]); - std::cout << price << std::endl; - std::cout << amount << std::endl; - } - catch(std::exception& e) - { - //error reading file - std::cout << "ERROR" << std::endl; - } - break; // can be removed to read all lines in the csv - } - csvFile.close(); - } - else - { - std::cout << "Could not open file" << std::endl; - } - - return 0; -} \ No newline at end of file