93 lines
2.3 KiB
C
Raw Normal View History

/*
* command line interface for user input
*
*/
2024-12-14 10:01:08 +01:00
/* Created by Juergen Buechel, 13.12.2024/
2024-12-14 21:44:35 +01:00
*/
#include "ui.h"
2024-12-14 21:36:09 +01:00
#include "planner.h" // for subject and event structs
2024-12-13 22:26:20 +01:00
#include <stdio.h>
#include <stdlib.h>
2024-12-14 21:36:09 +01:00
#include <assert.h>
2024-12-14 10:01:08 +01:00
2024-12-14 21:36:09 +01:00
#include "db.h"
#include "llist.h"
2024-12-14 21:44:35 +01:00
#include "planner.h"
2024-12-13 22:26:20 +01:00
2024-12-14 21:44:35 +01:00
int main(void) {
char taskname;
int taskcreation_date;
int taskdeadline_date;
int taskpriority;
int taskspare;
// Uninitialized Vars! values must be known and alloced first!
Task *task = newTask(taskname, taskcreation_date, taskdeadline_date,
taskpriority, taskspare);
{
// Insert task into the linked list
if (list == NULL) { // which list
// If the list is empty, initialize it with the first task
//
// task can be NULL to init llist.
// use llist->next to gitve to next function
list = llistNew(task, cmpTaskN);
} else {
// Append the task to the linked list
llistAppend(list, task); // task would be appended for 2nd time here
}
}
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); // string not single char
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));
}
2024-12-13 22:26:20 +01:00
}
2024-12-14 21:44:35 +01:00
break;
// case 4: iCAl();break;
}
2024-12-13 22:26:20 +01:00
}
2024-12-14 21:44:35 +01:00
while (choice != 5)
;
return EXIT_SUCCESS;
}
2024-12-13 22:26:20 +01:00
}