diff --git a/cv5/a_train.c b/cv5/a_train.c index a2d9383..893e404 100644 --- a/cv5/a_train.c +++ b/cv5/a_train.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "a_train.h" diff --git a/cv5/main.c b/cv5/main.c new file mode 100644 index 0000000..307c953 --- /dev/null +++ b/cv5/main.c @@ -0,0 +1,35 @@ +#include "a_train.h" +#include +#include +// Testovaci subor pre vlak +int main(){ + printf("Zadajte zoznam cieľových staníc a počet cestujúcich.\n"); + printf("Zoznam zakončite prázdnym riadkom.\n"); + struct car* train = NULL; + + while(1){ + char car[30]; + memset(car, 0, 30); + char* r = fgets(car, 30, stdin); + if(car[0] == '\n'){ + break; + } + car[strlen(car)-1] = '\0'; + if(isdigit(car[0])){ + continue; + } + train = add_car(train, car); + } + printf("Zadajte stanicu, ktorá sa má vyradiť:\n"); + char clear[30]; + memset(clear, 0 ,30); + char* x = fgets(clear,30,stdin); + clear[strlen(clear)-1] = '\0'; + + printf("Výsledný vlak bez stanice %s bude:\n", clear); + clear_train(train, clear); + print_train(train); + cancel_train(train); + + return 0; +}