36 lines
906 B
C
36 lines
906 B
C
#include "a_train.h"
|
|
#include <stdio.h>
|
|
#include <ctype.h>
|
|
// 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;
|
|
}
|