Share
Explore BrainMass

Writing a C++ Program Declaring Three Single Dimensional Arrays

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.

Solution Summary

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

$2.19