Aktualizacja makefila i poprawki
This commit is contained in:
@@ -68,7 +68,7 @@ PROJECT_LOGO =
|
|||||||
# entered, it will be relative to the location where doxygen was started. If
|
# entered, it will be relative to the location where doxygen was started. If
|
||||||
# left blank the current directory will be used.
|
# left blank the current directory will be used.
|
||||||
|
|
||||||
OUTPUT_DIRECTORY = /home/vectorkappa/CODE/Polsl/PPK_LAB/427f5252-gr04-repo/Projekt/Dokumentacja
|
OUTPUT_DIRECTORY = ./Dokumentacja
|
||||||
|
|
||||||
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096
|
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096
|
||||||
# sub-directories (in 2 levels) under the output directory of each output format
|
# sub-directories (in 2 levels) under the output directory of each output format
|
||||||
|
|||||||
@@ -1,2 +1,6 @@
|
|||||||
build:
|
build:
|
||||||
g++ -Iinclude main.cpp
|
g++ -Iinclude main.cpp
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f a.out
|
||||||
|
rm -rf Dokumentacja
|
||||||
|
|||||||
@@ -10,20 +10,28 @@ Zapis (<klient C> -> <klient D> : <odległość CD>), oznacza długość drogi j
|
|||||||
od klienta C do klienta D. Poszczególne drogi są rozdzielone przecinkami. Nie jest podana
|
od klienta C do klienta D. Poszczególne drogi są rozdzielone przecinkami. Nie jest podana
|
||||||
liczba dróg. Jeżeli nie jest możliwe wyznaczenie drogi, program zgłasza odpowiedni
|
liczba dróg. Jeżeli nie jest możliwe wyznaczenie drogi, program zgłasza odpowiedni
|
||||||
komunikat. Przykładowy plik wejściowy:
|
komunikat. Przykładowy plik wejściowy:
|
||||||
(1 - 2 : 4.5), (4 -> 3:
|
(1 - 2 : 4.5), (4 -> 3 : 4.5), (4 - 2 : 0.4)
|
||||||
4.5),
|
|
||||||
(4 - 2: 0.4)
|
|
||||||
W pliku wynikowym należy zapisać drogę kuriera (kolejność odwiedzania klientów i długość
|
W pliku wynikowym należy zapisać drogę kuriera (kolejność odwiedzania klientów i długość
|
||||||
drogi).
|
drogi).
|
||||||
Program uruchamiany jest z linii poleceń z potrzebnymi przełącznikami, natomiast
|
Program uruchamiany jest z linii poleceń z potrzebnymi przełącznikami, natomiast
|
||||||
uruchomienie programu bez parametrów powoduje wypisanie krótkiej instrukcji **/
|
uruchomienie programu bez parametrów powoduje wypisanie krótkiej instrukcji
|
||||||
|
|
||||||
|
1 2 3 4
|
||||||
|
1 4.5
|
||||||
|
|
||||||
|
2 4.5 0.4
|
||||||
|
|
||||||
|
3 4.5
|
||||||
|
|
||||||
|
4 0.4
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cxxopts.hpp>
|
#include <cxxopts.hpp>
|
||||||
cxxopts::Options options("Kurier", "Program rozwiązujący problem kuriera");
|
cxxopts::Options options("Kurier", "Program rozwiązujący problem kuriera");
|
||||||
char helpText[] = "To jest program rozwiązujący problem kuriera. Użycie: kurier -i [plik wejściowy] -o [plik wyjściowy]";
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,9 +43,8 @@ using namespace std;
|
|||||||
*
|
*
|
||||||
* @return iterator pliku
|
* @return iterator pliku
|
||||||
*/
|
*/
|
||||||
int parseInput(char* inputFile){
|
int parseInput(char* inputFile) {
|
||||||
fopen(inputFile, "r");
|
fopen(inputFile, "r");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -50,32 +57,35 @@ int main (int argc, char *argv[])
|
|||||||
options.add_options()
|
options.add_options()
|
||||||
("d,debug", "Włącza tryb debugowania") // a bool parameter
|
("d,debug", "Włącza tryb debugowania") // a bool parameter
|
||||||
("h,help", "Pokazuje pomoc") // a bool parameter
|
("h,help", "Pokazuje pomoc") // a bool parameter
|
||||||
("i,input", "Nazwa pliku wejściowego", cxxopts::value<std::string>())
|
("i,input", "Nazwa pliku wejściowego", cxxopts::value<string>())
|
||||||
("o,output", "Nazwa pliku wyjściowego", cxxopts::value<std::string>())
|
("o,output", "Nazwa pliku wyjściowego", cxxopts::value<string>())
|
||||||
("v,verbose", "Verbose output", cxxopts::value<bool>()->default_value("false"));
|
("v,verbose", "Pokazuje tok działania programu", cxxopts::value<bool>()->default_value("false"));
|
||||||
|
|
||||||
auto result = options.parse(argc, argv);
|
auto result = options.parse(argc, argv);
|
||||||
|
|
||||||
|
// Jeżeli przełącznik -h jest ustawiony albo nie podano argumetów, wyświetla pomoc.
|
||||||
if (result.count("help") || argc == 1){
|
if (result.count("help") || argc == 1) {
|
||||||
std::cout << options.help() << std::endl;
|
std::cout << options.help() << std::endl;
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
bool debug = result["debug"].as<bool>();
|
bool debug = result["debug"].as<bool>();
|
||||||
std::string plikWejsciowy;
|
string plikWejsciowy;
|
||||||
if (result.count("input"))
|
string plikWyjsciowy;
|
||||||
plikWejsciowy = result["input"].as<std::string>();
|
if (result.count("input") && result.count("output")) {
|
||||||
|
plikWejsciowy = result["input"].as<string>();
|
||||||
|
plikWyjsciowy = result["output"].as<string>();
|
||||||
|
} else {
|
||||||
|
std::cout << "Błąd 03 - nie podano wymaganych parametrów" << std::endl << options.help() << std::endl;
|
||||||
|
exit(3);
|
||||||
|
}
|
||||||
|
|
||||||
if (debug == true) {
|
if (debug == true) {
|
||||||
for (int i = 0; i < argc; i++) {
|
for (int i = 0; i < argc; i++) {
|
||||||
std::cout << argv[i] << std::endl;
|
std::cout << argv[i] << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user