commit
10dc2a7e04
67
src/ui.c
67
src/ui.c
|
@ -9,6 +9,7 @@
|
|||
#include <stdlib.h>
|
||||
#include "ui.h"
|
||||
#include <assert.h>
|
||||
#include "db.h"
|
||||
#include "llist.h"
|
||||
|
||||
|
||||
|
@ -24,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) {
|
||||
|
@ -33,9 +34,9 @@ int main(void)
|
|||
list = llistAppend(list, task); // Rückgabewert verwenden
|
||||
}
|
||||
|
||||
|
||||
int choice = 0, i = 0;
|
||||
do {
|
||||
do
|
||||
{
|
||||
printf(" -1- Neues Fach eingeben\n");
|
||||
printf(" -2- Verfuegbare Zeit eingeben\n");
|
||||
printf(" -3- Alle vorhandenen Faecher aufliesten\n");
|
||||
|
@ -45,12 +46,10 @@ int main(void)
|
|||
if( scanf("%d", &choice) != 1){
|
||||
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");
|
||||
|
@ -76,37 +75,31 @@ 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);
|
||||
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 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 4: iCAl();break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
// case 4: iCAl();break;
|
||||
}
|
||||
}while (choice !=5);
|
||||
}
|
||||
}while (choice !=5); {
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue