I'm trying to print this LIST but it's driving me insane.
So this is the output that I wanted to get :
Veranstaltungen:
1: Freitag 08:00 - 09:30 SU Informatik III Kevin Kaufmann H3
2: Freitag 10:00 - 11:30 Ueb Informatik III Kevin Kaufmann D 114
3: Freitag 12:15 - 13:45 Ueb Informatik III Kevin Kaufmann D 114
4: Montag 10:00 - 11:30 SU Mathe III Nathan Neuling B 301
5: Mittwoch 10:00 - 11:30 Ueb Mathe III Nathan Neuling D 209
6: Donnerstag 16:00 - 17:30 Englisch Sabine Sauber D 419
7: Dienstag 16:00 - 17:30 SU Digitale Systeme Willi Witzig H5
8: Dienstag 17:45 - 19:15 Ueb Digitale Systeme Willi Witzig D 114
This is the print function in my code :
I tried first of all this simple alternative here:
void CEvents::print()
{
cout << "Veranstaltungen:" << endl ;
for (int i = 0 ; i < counter;i++)
{
CWeekday Day = Events[i]->WeekDay;
cout<<i+1<<": "<<Events[i]->getDay(Day) << " ";
Events[i]->Block->print();
cout<<" "<<Events[i]->Name<<" "<<Events[i]->Teacher->Name<<" "<<Events[i]->Room->Name<< endl;
}
}
I got from this code this output :
Veranstaltungen:
1: Freitag 08:00 - 09:30 SU Informatik III Kevin Kaufmann H3
2: Freitag 10:00 - 11:30 Ueb Informatik III Kevin Kaufmann D 114
3: Freitag 12:15 - 13:45 Ueb Informatik III Kevin Kaufmann D 114
4: Montag 10:00 - 11:30 SU Mathe III Nathan Neuling B 301
5: Mittwoch 10:00 - 11:30 Ueb Mathe III Nathan Neuling D 209
6: Donnerstag 16:00 - 17:30 Englisch Sabine Sauber D 419
7: Dienstag 16:00 - 17:30 SU Digitale Systeme Willi Witzig H5
8: Dienstag 17:45 - 19:15 Ueb Digitale Systeme Willi Witzig D 114
Of course this one won't work correctly because they all don't have the same lengths but atleast the first part here is correct .
Then I tried to switch to printf() instead of cout , got a little closer to the result but still not the same :
extern "C" void CEvents::print()
{
cout << "Veranstaltungen:" << endl ;
string a= " ";
for (int i = 0 ; i < counter;i++)
{
CWeekday Day = Events[i]->WeekDay;
printf("%d: %10s %5s",i+1,Events[i]->getDay(Day).c_str(),a.c_str());
Events[i]->Block->print();
printf("%30s %20s %10s\n",Events[i]->Name.c_str(),Events[i]->Teacher->Name.c_str(),Events[i]->Room->Name.c_str());
}
}
For this code I got this output :
1: Freitag 08:00 - 09:30 SU Informatik III Kevin Kaufmann H3
2: Freitag 10:00 - 11:30 Ueb Informatik III Kevin Kaufmann D 114
3: Freitag 12:15 - 13:45 Ueb Informatik III Kevin Kaufmann D 114
4: Montag 10:00 - 11:30 SU Mathe III Nathan Neuling B 301
5: Mittwoch 10:00 - 11:30 Ueb Mathe III Nathan Neuling D 209
6: Donnerstag 16:00 - 17:30 Englisch Sabine Sauber D 419
7: Dienstag 16:00 - 17:30 SU Digitale Systeme Willi Witzig H5
8: Dienstag 17:45 - 19:15 Ueb Digitale Systeme Willi Witzig D 114
Now second part is correct(the time) and the other parts are not. How do I make this format correctly ?