parent
bf14307a71
commit
63ee77f5c4
|
@ -1,7 +0,0 @@
|
||||||
/* INPUT: linked list of events
|
|
||||||
*
|
|
||||||
* OUTPUT: Ical File, OK to caller
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "planner.h" // for task and event structs
|
|
83
src/ui.c
83
src/ui.c
|
@ -4,39 +4,41 @@
|
||||||
*/
|
*/
|
||||||
/* Created by Juergen Buechel, 13.12.2024/
|
/* Created by Juergen Buechel, 13.12.2024/
|
||||||
*/
|
*/
|
||||||
|
#include "ui.h"
|
||||||
|
// #include "db.h"
|
||||||
|
#include "llist.h"
|
||||||
#include "planner.h" // for subject and event structs
|
#include "planner.h" // for subject and event structs
|
||||||
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "ui.h"
|
|
||||||
#include <assert.h>
|
|
||||||
#include "db.h"
|
|
||||||
#include "llist.h"
|
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
int main(void)
|
char taskname[256]; // taskName Buffer
|
||||||
{
|
|
||||||
char taskname ;
|
|
||||||
int taskcreation_date = 0;
|
int taskcreation_date = 0;
|
||||||
int taskdeadline_date = 0;
|
int taskdeadline_date = 0;
|
||||||
int taskpriority = 0;
|
int taskpriority = 0;
|
||||||
int taskspare = 0;
|
int taskspare = 0;
|
||||||
llist *list = NULL;
|
// llist *list = NULL;
|
||||||
|
//
|
||||||
Task *task = newTask(taskname, taskcreation_date, taskdeadline_date, taskpriority, taskspare);
|
// Task *task = newTask(taskname, taskcreation_date, taskdeadline_date,
|
||||||
if (task == NULL) {
|
// taskpriority, taskspare); if (task == NULL) {
|
||||||
printf("Fehler beim Erstellen der Aufgabe.\n");
|
// printf("Fehler beim Erstellen der Aufgabe.\n");
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
// if (list == NULL) {
|
||||||
|
// list = llistNew(task, cmpTaskN);
|
||||||
|
// } else {
|
||||||
|
// list = llistAppend(list, task); // Rückgabewert verwenden
|
||||||
|
// }
|
||||||
|
llist *list = llistNew(NULL, cmpTaskN);
|
||||||
if (list == NULL) {
|
if (list == NULL) {
|
||||||
list = llistNew(task, cmpTaskN);
|
printf("Fehler beim Erstellen der Aufgabe.\n");
|
||||||
} else {
|
return 1;
|
||||||
list = llistAppend(list, task); // Rückgabewert verwenden
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int choice = 0, i = 0;
|
int choice = 0, i = 0;
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
printf(" -1- Neues Fach eingeben\n");
|
printf(" -1- Neues Fach eingeben\n");
|
||||||
printf(" -2- Verfuegbare Zeit eingeben\n");
|
printf(" -2- Verfuegbare Zeit eingeben\n");
|
||||||
printf(" -3- Alle vorhandenen Faecher aufliesten\n");
|
printf(" -3- Alle vorhandenen Faecher aufliesten\n");
|
||||||
|
@ -44,7 +46,8 @@ int main(void)
|
||||||
printf(" -5- Planer beenden\n");
|
printf(" -5- Planer beenden\n");
|
||||||
printf(" Wähle die gewünschte Option aus\n");
|
printf(" Wähle die gewünschte Option aus\n");
|
||||||
if (scanf("%d", &choice) != 1) {
|
if (scanf("%d", &choice) != 1) {
|
||||||
printf("Falsche Eingabe\n");};
|
printf("Falsche Eingabe\n");
|
||||||
|
};
|
||||||
choice = 0;
|
choice = 0;
|
||||||
|
|
||||||
while ((choice < 1 || choice > 5)) {
|
while ((choice < 1 || choice > 5)) {
|
||||||
|
@ -56,21 +59,18 @@ int main(void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
printf(" Wie viel Zeit bleibt ihnen:\n");
|
printf(" Wie viel Zeit bleibt ihnen:\n");
|
||||||
if (scanf("%d", &taskdeadline_date) != 1) {
|
if (scanf("%d", &taskdeadline_date) != 1) {
|
||||||
printf("Ungültige Eingabe.\n");
|
printf("Ungültige Eingabe.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
printf(" Gib die Priorität des Faches an: \n");
|
printf(" Gib die Priorität des Faches an: \n");
|
||||||
if (scanf("%d", &taskpriority) != 1) {
|
if (scanf("%d", &taskpriority) != 1) {
|
||||||
printf("Ungültige Eingabe.\n");
|
printf("Ungültige Eingabe.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
printf(" Wie viel Zeit habe Sie für dieses Fach: \n");
|
printf(" Wie viel Zeit habe Sie für dieses Fach: \n");
|
||||||
if (scanf("%d", &taskspare) != 1) {
|
if (scanf("%d", &taskspare) != 1) {
|
||||||
printf("Ungültige Eingabe.\n");
|
printf("Ungültige Eingabe.\n");
|
||||||
|
@ -78,28 +78,31 @@ int main(void)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
printf("Geben Sie die zur verfuegung stehende Zeit für die Fächer an: \n");
|
printf(
|
||||||
scanf("%c", &taskspare);
|
"Geben Sie die zur verfuegung stehende Zeit für die Fächer an: \n");
|
||||||
|
scanf("%d", &taskspare);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: if( task == NULL){
|
case 3:
|
||||||
printf("Die Liste ist leer");
|
// if (task == NULL) {//task?
|
||||||
}
|
// printf("Die Liste ist leer");
|
||||||
else{
|
// } else {
|
||||||
llist *iterator = list;
|
// llist *iterator = list;
|
||||||
while (iterator != NULL) {
|
// while (iterator != NULL) {
|
||||||
Task *currentTask = (Task *)(iterator->data); // Cast zu Task
|
// Task *currentTask = (Task *)(iterator->data); // Cast zu Task
|
||||||
printf("Fach: %s, Deadline: %ld, Priorität: %d\n",
|
// printf("Fach: %s, Deadline: %ld, Priorität: %d\n",
|
||||||
currentTask->name, currentTask->deadline, currentTask->priority);
|
// currentTask->name, currentTask->deadline,
|
||||||
iterator = iterator->next; // Gehe zum nächsten Listenelement
|
// currentTask->priority);
|
||||||
}
|
// iterator = iterator->next; // Gehe zum nächsten Listenelement
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
break;
|
break;
|
||||||
// case 4: iCAl();break;
|
// case 4: iCAl();break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}while (choice !=5); {
|
} while (choice != 5);
|
||||||
|
{
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue