5. Define a struct, carType, to store the following data about a car: Manufactur
ID: 3877373 • Letter: 5
Question
5. Define a struct, carType, to store the following data about a car: Manufacturer(string), model (string), model type (string), color (string), number of doors (int), miles per gallon in city (int), miles per gallon on highway (int), year when the car was built (int), and the price (double). Consider the declaration of the struct houseType given in Chapter 9 of your textbook. Write C++ statements to do the following: 6. a) Declare variables oldHouse and newHouse of type houseType b) Store the following information into oldHouse: style -Two-story, number of bedrooms - 5, number of bathrooms - 3, number of cars in garage -4, year built 1975, finished square footage 3500, price - 675,000, and tax 12500 c) Copy the values of the components of oldlouse into the corresponding components of newllouseExplanation / Answer
#5
struct carType
{
string Manufacturer;
string model;
string modelType;
string color;
int number_of_doors;
int miles_per_gallon_in_city;
int miles_per_gallon_on_highway;
int year_of_built;
double price;
}
#7
a)Invalid
explanation: callNum is declared as int in struct courseType, but string is assigned
b)
Invalid
explanation: name is a struct nameType, not a single dataType, should call specifically
c)
Invalid
explanation: callList[0] is of struct studentType, but name is of struct nameType
d)valid
e)valid
f)valid
g)
Invalid
explanation: again here classList[10] is a structure
h)valid
i)valid
j)valid
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.