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
|
||||
# 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
|
||||
# sub-directories (in 2 levels) under the output directory of each output format
|
||||
|
||||
@@ -1,2 +1,6 @@
|
||||
build:
|
||||
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
|
||||
liczba dróg. Jeżeli nie jest możliwe wyznaczenie drogi, program zgłasza odpowiedni
|
||||
komunikat. Przykładowy plik wejściowy:
|
||||
(1 - 2 : 4.5), (4 -> 3:
|
||||
4.5),
|
||||
(4 - 2: 0.4)
|
||||
(1 - 2 : 4.5), (4 -> 3 : 4.5), (4 - 2 : 0.4)
|
||||
W pliku wynikowym należy zapisać drogę kuriera (kolejność odwiedzania klientów i długość
|
||||
drogi).
|
||||
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 <iomanip>
|
||||
#include <string>
|
||||
#include <cxxopts.hpp>
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -35,10 +43,9 @@ using namespace std;
|
||||
*
|
||||
* @return iterator pliku
|
||||
*/
|
||||
int parseInput(char* inputFile){
|
||||
fopen(inputFile, "r");
|
||||
|
||||
return 0;
|
||||
int parseInput(char* inputFile) {
|
||||
fopen(inputFile, "r");
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* @brief Główna funkcja.
|
||||
@@ -47,35 +54,38 @@ int parseInput(char* inputFile){
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
|
||||
options.add_options()
|
||||
("d,debug", "Włącza tryb debugowania") // a bool parameter
|
||||
("h,help", "Pokazuje pomoc") // a bool parameter
|
||||
("i,input", "Nazwa pliku wejściowego", cxxopts::value<std::string>())
|
||||
("o,output", "Nazwa pliku wyjściowego", cxxopts::value<std::string>())
|
||||
("v,verbose", "Verbose output", cxxopts::value<bool>()->default_value("false"));
|
||||
options.add_options()
|
||||
("d,debug", "Włącza tryb debugowania") // a bool parameter
|
||||
("h,help", "Pokazuje pomoc") // a bool parameter
|
||||
("i,input", "Nazwa pliku wejściowego", cxxopts::value<string>())
|
||||
("o,output", "Nazwa pliku wyjściowego", cxxopts::value<string>())
|
||||
("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);
|
||||
|
||||
|
||||
if (result.count("help") || argc == 1){
|
||||
std::cout << options.help() << std::endl;
|
||||
exit(0);
|
||||
// Jeżeli przełącznik -h jest ustawiony albo nie podano argumetów, wyświetla pomoc.
|
||||
if (result.count("help") || argc == 1) {
|
||||
std::cout << options.help() << std::endl;
|
||||
exit(0);
|
||||
}
|
||||
bool debug = result["debug"].as<bool>();
|
||||
std::string plikWejsciowy;
|
||||
if (result.count("input"))
|
||||
plikWejsciowy = result["input"].as<std::string>();
|
||||
string plikWejsciowy;
|
||||
string plikWyjsciowy;
|
||||
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) {
|
||||
for (int i = 0; i < argc; i++) {
|
||||
std::cout << argv[i] << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (debug == true) {
|
||||
for (int i = 0; i < argc; i++) {
|
||||
std::cout << argv[i] << std::endl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user