This commit is contained in:
Maryna Kravtsova 2020-11-23 16:19:47 +01:00
parent 6d9c7de58a
commit e81c351f5e
2 changed files with 36 additions and 0 deletions

View File

@ -1,6 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#include "a_train.h" #include "a_train.h"

35
cv5/main.c Normal file
View File

@ -0,0 +1,35 @@
#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;
}