modified: src/ui.c
parent
834b3270b9
commit
b308dc4c95
142
src/ui.c
142
src/ui.c
|
@ -3,96 +3,90 @@
|
|||
*
|
||||
*/
|
||||
/* Created by Juergen Buechel, 13.12.2024/
|
||||
*/
|
||||
*/
|
||||
#include "ui.h"
|
||||
#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"
|
||||
#include "planner.h"
|
||||
|
||||
int main(void) {
|
||||
char taskname;
|
||||
int taskcreation_date;
|
||||
int taskdeadline_date;
|
||||
int taskpriority;
|
||||
int taskspare;
|
||||
|
||||
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);
|
||||
}
|
||||
// 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;
|
||||
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);
|
||||
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(" Wie viel Zeit bleibt ihnen:\n") scanf("%c", taskdeadline_date);
|
||||
|
||||
printf(" Gib die Priorität des Faches an: \n");
|
||||
scanf("%c", &taskpriority);
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue