Explore BrainMass

Writing a C++ Program Declaring Three Single Dimensional Arrays

Not what you're looking for? Search our solutions OR ask your own Custom question.

This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

Write a program that declares three single dimensional arrays named miles, gallon, and mpg. Each array should be capable of holding 5 elements. In the miles array, store the numbers 240.5, 300, 189.6, 177.4 and 192.3. In the gallons array store the numbers 10.3, 15.7, 14.9, 10.7 and 8.4. Each element of the mpg array should be calculated as the corresponding element of the miles array divided by the equivalent element gallons array; for example mpg[0] = miles [0] / gallons [0]

Use pointers when calculating and displaying the elements of the mpg array.

https://brainmass.com/computer-science/cpp/writing-program-declaring-three-single-dimensional-arrays-180890

SOLUTION This solution is FREE courtesy of BrainMass!

Please see the attached C++ code.

This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!