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/
|
/* Created by Juergen Buechel, 13.12.2024/
|
||||||
*/
|
*/
|
||||||
|
#include "ui.h"
|
||||||
#include "planner.h" // for subject and event structs
|
#include "planner.h" // for subject and event structs
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "ui.h"
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "planner.h"
|
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "llist.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)
|
// Uninitialized Vars! values must be known and alloced first!
|
||||||
{
|
Task *task = newTask(taskname, taskcreation_date, taskdeadline_date,
|
||||||
char taskname;
|
taskpriority, taskspare);
|
||||||
int taskcreation_date;
|
{
|
||||||
int taskdeadline_date;
|
// Insert task into the linked list
|
||||||
int taskpriority;
|
if (list == NULL) { // which list
|
||||||
int taskspare;
|
// If the list is empty, initialize it with the first task
|
||||||
|
//
|
||||||
Task *task = newTask(taskname, taskcreation_date, taskdeadline_date, taskpriority, taskspare);
|
// task can be NULL to init llist.
|
||||||
{
|
// use llist->next to gitve to next function
|
||||||
// Insert task into the linked list
|
list = llistNew(task, cmpTaskN);
|
||||||
if (list == NULL) {
|
} else {
|
||||||
// If the list is empty, initialize it with the first task
|
// Append the task to the linked list
|
||||||
list = llistNew(task, cmpTaskN);
|
llistAppend(list, task); // task would be appended for 2nd time here
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Append the task to the linked list
|
|
||||||
llistAppend(list, task);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int time;
|
int time;
|
||||||
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");
|
printf(" -4- Kalenderlink ausgeben\n");
|
||||||
printf(" -4- Kalenderlink ausgeben\n");
|
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)) {
|
||||||
switch (choice)
|
switch (choice) {
|
||||||
{
|
case 1: {
|
||||||
case 1:
|
printf(" Geben sie das gewünschte Fach ein: \n");
|
||||||
{
|
scanf("%c", taskname); // string not single char
|
||||||
printf(" Geben sie das gewünschte Fach ein: \n");
|
|
||||||
scanf("%c",taskname);
|
|
||||||
|
|
||||||
printf(" Wie viel Zeit bleibt ihnen:\n")
|
printf(" Wie viel Zeit bleibt ihnen:\n") scanf("%c", taskdeadline_date);
|
||||||
scanf("%c", taskdeadline_date);
|
|
||||||
|
|
||||||
printf(" Gib die Priorität des Faches an: \n");
|
printf(" Gib die Priorität des Faches an: \n");
|
||||||
scanf("%c", &taskpriority);
|
scanf("%c", &taskpriority);
|
||||||
|
|
||||||
printf(" Wie viel Zeit habe Sie für dieses Fach: \n");
|
printf(" Wie viel Zeit habe Sie für dieses Fach: \n");
|
||||||
scanf("%c", taskspare);
|
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;
|
|
||||||
|
|
||||||
|
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