From 5d5527ee06f024db0fd122bcf249daca16d73ec5 Mon Sep 17 00:00:00 2001 From: VectorKappa Date: Mon, 13 Feb 2023 00:39:52 +0100 Subject: [PATCH] =?UTF-8?q?Du=C5=BCo=20zmian=20a=20terminy=20goni=C4=85...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projekt/main.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/Projekt/main.cpp b/Projekt/main.cpp index 39b431a..b0bd755 100644 --- a/Projekt/main.cpp +++ b/Projekt/main.cpp @@ -30,10 +30,41 @@ uruchomienie programu bez parametrów powoduje wypisanie krótkiej instrukcji #include #include #include -#include -cxxopts::Options options("Kurier", "Program rozwiązujący problem kuriera"); +#include "include/cxxopts.hpp" +#include +#include +#include +#include +#include + + using namespace std; +cxxopts::Options options("Kurier", "Program rozwiązujący problem kuriera"); + +/* + * + * Parsujemy A, B, rodzaj korelacji , dystans + * + * + */ + +std::vector> macierzOdległości; + + + + +/* + * @brief Funkcja czyszcząca stringi z niepotrzebnych znaków + */ + + +void czyscStringa( string &str, char* znakiDoCzyszczenia ) { + for ( unsigned int i = 0; i < strlen(znakiDoCzyszczenia); ++i ) { + str.erase( remove(str.begin(), str.end(), znakiDoCzyszczenia[i]), str.end() ); + } +} + /** * @brief Funkcja parsująca dane wejściowe. * @@ -43,9 +74,13 @@ using namespace std; * * @return iterator pliku */ -int parseInput(char* inputFile) { - fopen(inputFile, "r"); - return 0; +void parseInput(string inputFile) { + ifstream file(inputFile); + std::string token; + while(std::getline(file, token, ',')) { + czyscStringa(token, "()"); + std::cout << token << std::endl; + } } /** * @brief Główna funkcja. @@ -73,9 +108,10 @@ int main (int argc, char *argv[]) string plikWyjsciowy; if (result.count("input") && result.count("output")) { plikWejsciowy = result["input"].as(); + parseInput(plikWejsciowy); plikWyjsciowy = result["output"].as(); } else { - std::cout << "Błąd 03 - nie podano wymaganych parametrów" << std::endl << options.help() << std::endl; + std::cout << std::endl << "Błąd 03 - nie podano wymaganych parametrów" << std::endl << std::endl << std::endl << options.help() << std::endl; exit(3); } if (debug == true) {