2024-12-14 21:36:09 +01:00

99 lines
2.4 KiB
C

/*
* command line interface for user input
*
*/
/* Created by Juergen Buechel, 13.12.2024/
*/
#include "planner.h" // for subject and event structs
#include <stdio.h>
#include <stdlib.h>
#include "ui.h"
#include <assert.h>
#include "planner.h"
#include "db.h"
#include "llist.h"
int main(void)
{
char taskname;
int taskcreation_date;
int taskdeadline_date;
int taskpriority;
int taskspare;
Task *task = newTask(taskname, taskcreation_date, taskdeadline_date, taskpriority, taskspare);
{
// Insert task into the linked list
if (list == NULL) {
// If the list is empty, initialize it with the first task
list = llistNew(task, cmpTaskN);
}
else {
// Append the task to the linked list
llistAppend(list, task);
}
}
int time;
int choice = 0, i = 0;
do
{
printf(" -1- Neues Fach eingeben\n");
printf(" -2- Verfuegbare Zeit eingeben\n");
printf(" -3- Alle vorhandenen Faecher aufliesten\n");
printf(" -4- Kalenderlink ausgeben\n");
printf(" -5- Planer beenden\n");
printf(" Wähle die gewünschte Option aus\n");
if( scanf("%d", &choice) != 1){
printf("Falsche Eingabe\n");};
choice = 0;
while(( choice < 1 || choice > 5)){
switch (choice)
{
case 1:
{
printf(" Geben sie das gewünschte Fach ein: \n");
scanf("%c",taskname);
printf(" Wie viel Zeit bleibt ihnen:\n")
scanf("%c", taskdeadline_date);
printf(" Gib die Priorität des Faches an: \n");
scanf("%c", &taskpriority);
printf(" Wie viel Zeit habe Sie für dieses Fach: \n");
scanf("%c", taskspare);
}
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{
while (task != NULL)
{
printf("Faecher %d: \n", llistAppend(task));
}
}break;
// case 4: iCAl();break;
}
}while (choice !=5);
return EXIT_SUCCESS;
}
}