Question
6. Consider the following declarations: const int CAR_TYPES = 5; const int COLOR_TYPES = 6; double sales[CAR_TYPES][COLOR_TYPES]; a. How many components does the array sales
6. Consider the following declarations:
const int CAR_TYPES = 5;
const int COLOR_TYPES = 6;
double sales[CAR_TYPES][COLOR_TYPES];
a. How many components does the array sales have?
b. What is the number of rows in the array sales?
c. What is the number of columns in the array sales?
d. To sum the sales by CAR_TYPES, what kind of processing is required?
e. To sum the sales by COLOR_TYPES, what kind of processing is required?
7. Suppose that you have the following declarations:
int times[30][7];
int speed[15][7];
int trees[100][7];
int students[50][7];
a. Write the definition of the function print that can be used to output the contents of
these arrays.
b. Write the C++ statements that calls the function print to output the contents of the
arrays times, speed, trees, and students.
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