Dużo zmian a terminy gonią...

This commit is contained in:
2023-02-13 00:39:52 +01:00
parent d270357722
commit 5d5527ee06

View File

@@ -30,10 +30,41 @@ uruchomienie programu bez parametrów powoduje wypisanie krótkiej instrukcji
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <string> #include <string>
#include <cxxopts.hpp> #include "include/cxxopts.hpp"
cxxopts::Options options("Kurier", "Program rozwiązujący problem kuriera"); #include <algorithm>
#include <limits.h>
#include <queue>
#include <fstream>
#include <sstream>
using namespace std; using namespace std;
cxxopts::Options options("Kurier", "Program rozwiązujący problem kuriera");
/*
*
* Parsujemy A, B, rodzaj korelacji <bool>, dystans
*
*
*/
std::vector<std::vector<double>> 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. * @brief Funkcja parsująca dane wejściowe.
* *
@@ -43,9 +74,13 @@ using namespace std;
* *
* @return iterator pliku * @return iterator pliku
*/ */
int parseInput(char* inputFile) { void parseInput(string inputFile) {
fopen(inputFile, "r"); ifstream file(inputFile);
return 0; std::string token;
while(std::getline(file, token, ',')) {
czyscStringa(token, "()");
std::cout << token << std::endl;
}
} }
/** /**
* @brief Główna funkcja. * @brief Główna funkcja.
@@ -73,9 +108,10 @@ int main (int argc, char *argv[])
string plikWyjsciowy; string plikWyjsciowy;
if (result.count("input") && result.count("output")) { if (result.count("input") && result.count("output")) {
plikWejsciowy = result["input"].as<string>(); plikWejsciowy = result["input"].as<string>();
parseInput(plikWejsciowy);
plikWyjsciowy = result["output"].as<string>(); plikWyjsciowy = result["output"].as<string>();
} else { } 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); exit(3);
} }
if (debug == true) { if (debug == true) {