Add cv6/main.c
This commit is contained in:
		
							parent
							
								
									2bf25e2e04
								
							
						
					
					
						commit
						97d022cfac
					
				
							
								
								
									
										31
									
								
								cv6/main.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								cv6/main.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,31 @@ | ||||
| #include <stdio.h> | ||||
| #include "a_station.h" | ||||
| 
 | ||||
| 
 | ||||
| int main() { | ||||
|     // Створення станції
 | ||||
|     struct station* my_station = create_station(); | ||||
|     if (my_station == NULL) { | ||||
|         printf("Помилка створення станції.\n"); | ||||
|         return 1; | ||||
|     } | ||||
| 
 | ||||
|     // Додавання нових записів
 | ||||
|     add_target_capacity(my_station, "Kyiv", 50); | ||||
|     add_target_capacity(my_station, "Lviv", 30); | ||||
|     add_target_capacity(my_station, "Odessa", 20); | ||||
| 
 | ||||
|     // Отримання інформації про місто
 | ||||
|     printf("Кількість пасажирів до Kyiv: %d\n", get_target_capacity(my_station, "Kyiv")); | ||||
|     printf("Кількість пасажирів до Lviv: %d\n", get_target_capacity(my_station, "Lviv")); | ||||
|     printf("Кількість пасажирів до Odessa: %d\n", get_target_capacity(my_station, "Odessa")); | ||||
| 
 | ||||
|     // Підрахунок загальної кількості станцій та пасажирів
 | ||||
|     printf("Загальна кількість станцій: %d\n", count_targets(my_station)); | ||||
|     printf("Загальна кількість пасажирів: %d\n", count_capacity(my_station)); | ||||
| 
 | ||||
|     // Звільнення пам'яті
 | ||||
|     destroy_station(my_station); | ||||
| 
 | ||||
|     return 0; | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user