usaa24/cv4/main.c

33 lines
643 B
C
Raw Permalink Normal View History

2024-10-17 21:03:17 +00:00
#include "a_train.h"
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;
}