33 lines
643 B
C
33 lines
643 B
C
#include "a_train.c"
|
|
#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);
|
|
train = clear_train(train,buf);
|
|
|
|
print_train(train);
|
|
|
|
cancel_train(train);
|
|
|
|
return 0;
|
|
}
|