Explore BrainMass
Share

C++ array program

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

I have a program i'm having to write for a c++ class. it is dealing with arrays and while loops. we also have to get data from a file, and write it to another. my problem is i can't get it to read the data from the file. here's what the program should be able to do with the data.

1) print out all data in the array with no more than 5 per line
2) print out the avg of the numbers
3) print out how many numbers are smaller than the avg
4) for every odd location in the array, subtract it from the previous even location and store results in the even location. print out all values in the array.
5) print out avg for the new array
6) swap the first number in the array with the last number in array and print out.
7) print out the average for new array.

I have the cpp program I have written so far, with the data program. the data program is numbers.dat. Thanks for your help.

© BrainMass Inc. brainmass.com March 21, 2019, 6:31 pm ad1c9bdddf
https://brainmass.com/computer-science/cpp/c-array-program-259833

Attachments

Solution Preview

Dear student,

Please find the solution in the attached file. The code is fully commented so that you ...

Solution Summary

This solution helps with a problem involving a C++ array program.

$2.19