Hello I wrote this code everything works fine but i don'nt know how to put it all into an array. The user enteres 8 piece of information and i want all of that to be put into 1 element in an array. I will be greatful if someone can fix it for me.
Code:
#include <stdio.h>
#define s 20
typedef struct {
int day;
int month;
int year;
} Date;
typedef struct {
float cost;
} Price;
typedef struct {
char make[s];
Date purchaseDate;
Date manufactureDate;
Price purchasePrice;
} Car;
int main()
{
Date date;
Price price;
Car car;
printf("Please Enter the name of the car: ");
scanf("%s",&car.make);
printf(" Please enter the day of purchase: ");
scanf("%d", &car.purchaseDate.day);
printf(" Please enter the month of purchase: ");
scanf("%d", &car.purchaseDate.month);
printf(" Please enter the year of purchase: ");
scanf("%d", &car.purchaseDate.year);
printf(" Please enter the day of manufacture: ");
scanf("%d", &car.manufactureDate.day);
printf(" Please enter the month of manufacture: ");
scanf("%d", &car.manufactureDate.month);
printf(" Please enter the year of manufacture: ");
scanf("%d", &car.manufactureDate.year);
printf(" Please enter the price the car was bought for: ");
scanf("%f", &car.purchasePrice.cost);
printf(" The name of the car is %s \n", car.make);
printf(" The car was purchased on the %d of the %d month of the year %d \n", car.purchaseDate.day, car.purchaseDate.month, car.purchaseDate.year);
printf(" The car was manufactured on the %d of the %d month of the year %d \n", car.manufactureDate.day, car.manufactureDate.month, car.manufactureDate.year);
printf(" The car was bought for %f \n",car.purchasePrice.cost);
return 0;
}