From 7a098cd45544f9a55c2dfb42b764f508902a11cc Mon Sep 17 00:00:00 2001 From: MarcUs7i Date: Wed, 20 Nov 2024 20:18:41 +0100 Subject: [PATCH] added main.c --- car_main_driver.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/car_main_driver.c b/car_main_driver.c index 1bd4217..fc329a2 100644 --- a/car_main_driver.c +++ b/car_main_driver.c @@ -9,8 +9,31 @@ */ #include +#include "car.h" +#define TOTAL_CARS 6 + +void print_car(Car car, int index); int main(int argc, char const *argv[]) { - /* your code */ + Car cars[TOTAL_CARS]; + cars[0] = get_car(AIXAM); + cars[1] = get_car(FIAT_MULTIPLA); + cars[2] = get_car(FIAT_MULTIPLA); + cars[3] = get_car(FIAT_MULTIPLA); + cars[4] = get_car(JEEP); + cars[5] = get_car(JEEP); + + for (int i = 0; i < TOTAL_CARS; i++) { + print_car(cars[i], i); + } return 0; } + +void print_car(Car car, int index) { + printf("%d. Car: ", index + 1); + printf("Type: %d, ", get_type(car)); + printf("Color: %d, ", get_color(car)); + printf("Fill Level: %.1f, ", get_fill_level(car)); + printf("Acceleration Rate: %.2f, ", get_acceleration_rate(car)); + printf("Speed: %d\n", get_speed(car)); +} \ No newline at end of file