2024-10-17 21:02:31 +00:00
|
|
|
#include "a_train.c"
|
2024-10-17 20:15:38 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
char buf[50];
|
|
|
|
struct car* train = NULL;
|
|
|
|
memset(buf, 0, 50);
|
|
|
|
printf("Zadajte zoznam cieľových staníc.\nZoznam zakončite prázdnym riadkom.\n");
|
|
|
|
while (fgets(buf, 50, stdin) != NULL)
|
|
|
|
{
|
|
|
|
if(buf[0] == '\n')
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
buf[strcspn(buf, "\n")] = '\0';
|
|
|
|
train = add_car(train,buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
print_train(train);
|
|
|
|
|
|
|
|
printf("Zadajte stanicu, ktorá sa má vyradiť:\n");
|
|
|
|
scanf("%s", buf);
|
2024-10-17 20:42:42 +00:00
|
|
|
train = clear_train(train,buf);
|
2024-10-17 20:15:38 +00:00
|
|
|
|
|
|
|
print_train(train);
|
|
|
|
|
|
|
|
cancel_train(train);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|