Explore BrainMass
Share

Writing a C++ Program Declaring Three Single Dimensional Arrays

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.

© BrainMass Inc. brainmass.com March 21, 2019, 4:18 pm ad1c9bdddf
https://brainmass.com/computer-science/cpp/writing-program-declaring-three-single-dimensional-arrays-180890

Solution Summary

This solution provides guidelines on writing a program declaring three single dimensional arrays capable of holding 5 elements.

$2.19