Purchase Solution

C++ array program

Not what you're looking for?

Ask Custom Question

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.

Purchase this Solution

Solution Summary

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

Solution Preview

Dear student,

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

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.