added main.c
This commit is contained in:
parent
766ec0a593
commit
7a098cd455
1 changed files with 24 additions and 1 deletions
|
|
@ -9,8 +9,31 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "car.h"
|
||||||
|
#define TOTAL_CARS 6
|
||||||
|
|
||||||
|
void print_car(Car car, int index);
|
||||||
|
|
||||||
int main(int argc, char const *argv[]) {
|
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;
|
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));
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue