Plan and code a modular program utilizing arrays. Use at least three functions to solve the problem.
• Input numbers from a textfile. Input the numbers, one by one.
• Store the even numbers in one array.
• Store the odd numbers in a second array.
• Determine the average, highest, lowest value for the even array.
• Output all numbers higher than the average for the even array.
• Determine the average, highest, lowest value for the odd array.
• Output the numbers higher than the average for the odd array.
Label and output all values (high, low, average, numbers greater than the average) and each array. Clearly label all output.
Note
You MUST write ONE function to find high, lowest, and average for any array. Use this function once for even array and the same function once for the odd array. Write one function to output numbers higher than the average. Use once for the even array and once for the odd array.
Input
Numbers, one at a time, from the file shown below. Create the data file below in text editor or Notepad.
Data File
46 30 82 90 56 17 95 16 48 26
4 58 0 78 92 60 12 21 63 47
19 41 90 85 14 -9 52 71 79 16
80 51 95 102 34 10 79 95 61 92
89 88 66 64 92 63 66 64 39 5
Output
The contents of each array, the high, low, average for each array and a listing of the values higher than the average.
Hi, Im about to start this program and I want to clarify my thought for the problem restatement. Here's my function prototype:
1 2 3 4 5 6 7 8 9 10 11 12
|
#include <iostream>
#include <fstream>
#include<iomanip>
#include<string>
using namespace std;
void GetData (int&Num);
void CalcData(int&Num, int&OddNum, int&EvenNum, &float ave, int&HigherNum );
void findHigherNum (int&OddNum, int&EvenNum, int& HigherNum )
void SendData (int Num, int OddNum, int EvenNum, float ave, int HigherNum);
ifstream inputFile;
ofstream outputFile;
|
I will post my code later, I would like to ask any input from you guys, thanks much!