Question
A) Declare a structure data type with the following fields: Car Id (an integer between 1 and 1000), Miles Driven (integer), Gallons Used (integer). B)
A) Declare a structure data type with the following fields: Car Id (an integer between 1 and 1000), Miles Driven (integer), Gallons Used (integer).
B) Using the data type declared in (A), writea C++ program that accepts the total number of cars and then reads them in and stores them in an array. For example
5
25 1450 62
36 3240 136
44 1792 76
52 2360 105
68 2114 67
C) After the data has been entered, the program should create a printout listing each car number and the cars miles per gallon (as a float). At the end of the printout, include also the average miles per gallon (as a float) for the entire fleet of cars.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started