usaa24/cv4/main.c

33 lines
635 B
C
Raw Normal View History

2024-10-17 20:15:38 +00:00
#include "a_train.h"
#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);
clear_train(train,buf);
print_train(train);
cancel_train(train);
return 0;
}