From ad20db399509c29e361214191b9d8b229210243b Mon Sep 17 00:00:00 2001 From: juergen Date: Sat, 14 Dec 2024 22:20:10 +0100 Subject: [PATCH 1/3] changes --- src/ui.c | 55 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/src/ui.c b/src/ui.c index b2bab4d..e6cacf4 100644 --- a/src/ui.c +++ b/src/ui.c @@ -25,7 +25,7 @@ int main(void) Task *task = newTask(taskname, taskcreation_date, taskdeadline_date, taskpriority, taskspare); if (task == NULL) { printf("Fehler beim Erstellen der Aufgabe.\n"); - return -1; + return 0; } if (list == NULL) { @@ -48,7 +48,8 @@ int main(void) printf("Falsche Eingabe\n");}; choice = 0; - while(( choice < 1 || choice > 5)){ + while(( choice < 1 || choice > 5)) + { switch (choice) { case 1: @@ -78,35 +79,37 @@ int main(void) if (scanf("%d", &taskspare) != 1) { printf("Ungültige Eingabe.\n"); return -1; - } + } + break; + case 2: + printf("Geben Sie die zur verfuegung stehende Zeit für die Fächer an: \n"); + scanf("%c", &taskspare); break; - case 2: - printf("Geben Sie die zur verfuegung stehende Zeit für die Fächer an: \n"); - scanf("%c", &taskspare); - break; + case 3: if( task == NULL) + { + printf("Die Liste ist leer"); + } + else + { + llist *iterator = list; + while (iterator != NULL) { + Task *currentTask = (Task *)(iterator->data); // Cast zu Task + printf("Fach: %s, Deadline: %ld, Priorität: %d\n", + currentTask->name, currentTask->deadline, currentTask->priority); + iterator = iterator->next; // Gehe zum nächsten Listenelement + } + } - case 3: if( task == NULL){ - printf("Die Liste ist leer"); - } - else - { - llist *iterator = list; - while (iterator != NULL) { - Task *currentTask = (Task *)(iterator->data); // Cast zu Task - printf("Fach: %s, Deadline: %ld, Priorität: %d\n", - currentTask->name, currentTask->deadline, currentTask->priority); - iterator = iterator->next; // Gehe zum nächsten Listenelement + break; + // case 4: iCAl();break; + } + while (choice !=5);{ + return EXIT_SUCCESS; } } - break; - // case 4: iCAl();break; - } - }while (choice !=5); - return EXIT_SUCCESS; - - -} + } + } } From b792eed3d27bf6cb00cc79b01fedf4343bdb2abd Mon Sep 17 00:00:00 2001 From: juergen Date: Sat, 14 Dec 2024 22:23:02 +0100 Subject: [PATCH 2/3] changes --- src/ui.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ui.c b/src/ui.c index e6cacf4..d071f07 100644 --- a/src/ui.c +++ b/src/ui.c @@ -104,11 +104,12 @@ int main(void) break; // case 4: iCAl();break; } - while (choice !=5);{ - return EXIT_SUCCESS; - } + } } + + }while (choice !=5); { + return EXIT_SUCCESS; } } From bf14307a716826e485ff73cbdbf8f51afdb11faa Mon Sep 17 00:00:00 2001 From: juergen Date: Sat, 14 Dec 2024 22:26:40 +0100 Subject: [PATCH 3/3] minor changes --- src/ui.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/ui.c b/src/ui.c index d071f07..0d5c4d1 100644 --- a/src/ui.c +++ b/src/ui.c @@ -34,7 +34,6 @@ int main(void) list = llistAppend(list, task); // Rückgabewert verwenden } - int choice = 0, i = 0; do { @@ -48,12 +47,9 @@ int main(void) printf("Falsche Eingabe\n");}; choice = 0; - while(( choice < 1 || choice > 5)) - { - switch (choice) - { - case 1: - { + while(( choice < 1 || choice > 5)){ + switch (choice){ + case 1:{ printf(" Geben sie das gewünschte Fach ein: \n"); if (scanf("%255s", taskname) != 1) { printf("Ungültige Eingabe für den Namen.\n"); @@ -86,12 +82,10 @@ int main(void) scanf("%c", &taskspare); break; - case 3: if( task == NULL) - { + case 3: if( task == NULL){ printf("Die Liste ist leer"); } - else - { + else{ llist *iterator = list; while (iterator != NULL) { Task *currentTask = (Task *)(iterator->data); // Cast zu Task @@ -100,19 +94,12 @@ int main(void) iterator = iterator->next; // Gehe zum nächsten Listenelement } } - break; // case 4: iCAl();break; } - } } - }while (choice !=5); { return EXIT_SUCCESS; } -} - - - - +} \ No newline at end of file