mytrain
This commit is contained in:
parent
6d9c7de58a
commit
e81c351f5e
@ -1,6 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "a_train.h"
|
||||
|
||||
|
35
cv5/main.c
Normal file
35
cv5/main.c
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user