diff --git a/Task.cpp b/Task.cpp index 4df499a..fa07182 100644 --- a/Task.cpp +++ b/Task.cpp @@ -55,8 +55,16 @@ namespace models ostream& operator<<(ostream& os, const Task& t) { os << t.get_id() << " %" << t.get_name() << "% %" << t.get_description(); - for (const int id : t.children) - os << " " << id << " "; + // Fügt Childen Task mit passenden Lehrzeichen hinzu + if (!t.children.empty()) + os << " "; + for (size_t i = 0; i < t.children.size(); ++i) { + os << t.children[i]; + if (i < t.children.size() - 1) { + os << " "; + } + } + os << "\n"; return os; } @@ -71,6 +79,8 @@ namespace models try { string name = Util::read_string_between_percent(is); + if (name == "") + throw Error(102, "Ein Parameter eines Befehls konnte nicht gelesen werden"); string description = Util::read_string_between_percent(is); vector children = Util::read_numbers(is); t = {id, name, description, children}; diff --git a/main.cpp b/main.cpp index f45f2b6..4014c5c 100644 --- a/main.cpp +++ b/main.cpp @@ -50,16 +50,16 @@ int main(int argc, char** argv) { sc->run(parameter); if (sc->should_display_result()) - cout << "100\nAlles erfolgreich\n"; + cout << "100: Alles erfolgreich\n"; return 0; } } } catch (Error& e) { - cout << e.get_nr() << "\n" << e.what() << "\n"; + cout << e.get_nr() << ": " << e.what() << "\n"; return 0; } - cout << "101\nBefehl ist unbekannt.\n"; + cout << "101: Befehl ist unbekannt.\n"; return 0; }