fix: another Task one

This commit is contained in:
moonleay 2025-02-09 21:43:27 +01:00
parent f803d604a0
commit 36e4ff362d
Signed by: moonleay
GPG key ID: 82667543CCD715FB
2 changed files with 15 additions and 5 deletions

View file

@ -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<int> children = Util::read_numbers(is);
t = {id, name, description, children};

View file

@ -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;
}