* Compiler: gcc
*
* Author: Milan Kabat (), kabat@ics.muni.cz
* Company: FI MUNI
*
* =====================================================================================
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#define YEAR_SPAN 61
#define NUM_COLORS 6
#define NUM_BRANDS 7
char *brands[] = { "Opel", "Mazda", "Toyota", "Skoda", "Audi", "Buick", "Ford" };
enum colors { red, yellow, blue, green, white, black };
struct car {
char brand[20];
enum colors color;
int year;
};
void printCar(struct car *c) {
char color[10];
switch(c->color) {
case red: { strcpy(color, "Red"); break;}
case yellow: { strcpy(color, "Yellow"); break;}
case blue: { strcpy(color, "Blue"); break;}
case green: { strcpy(color, "Green"); break;}
case white: { strcpy(color, "White"); break;}
case black: { strcpy(color, "Black"); break;}
}
printf("| %-10s | %-10s | %d", color, c->brand, c->year);
}
/*
* === FUNCTION ======================================================================
* Name: main
* Description:
* =====================================================================================
*/
int main ( int argc, char *argv[] )
{
srand(time(NULL));
printf("\n\n");
11,1 43%