hi guys
i have a problem that asks me to work with a given structure and to set an array of 35 and initialize the elements. then i take a loop statement that will step through the entire array and display the contents of each element. since the question only asked me to do statements i did not do an entire program so please check if the following is correct :)
ps-i was already given the list of cars and models, etc.
//given struct
struct Car
{
char carMake[20];
char carModel[20];
int yearModel;
double cost;
};
//define array of car struct with 35 array and initialize elements
car vehicle1[35] = {Ford, Taurus, 1997};
car vehicle2[35] = {Honda, Accord, 1992};
car vehicle3[35] = {Lamborghini, Countach, 1997};
//write a loop that will step thru the array displaying contents of each element
for (int index = 0; index < 35; index++)
{
cout << vehicle[index].carMake << endl;
cout << vehicle[index].carModel << endl;
cout << vehicle[index].yearModel << endl;
}