Question
;> This assignment is to demonstrate the use of FUNCTIONS and ARRAYS . Write a program that meets the following requirements: 1. Read in a
;>
This assignment is to demonstrate the use of FUNCTIONS and ARRAYS.
Write a program that meets the following requirements:
1. Read in a maximum of 50 records, each record will be on a separate line using columns one and two.
Example:
36
O1
5H
2. Determine if each record is a positive integer. Keep track of all records that are not positive integers and print a list of them.
For all the positive integer data records:
3. Determine the average (mean) rounded to the nearest whole number, median, mode and standard deviation.
4. Compute the difference between each of the positive integers and the mean and store the difference in an array corresponding to the original integer number.
5. Determine which of the integers deviates the most from the mean, print the number and how much it deviates.
6. Print the original list of integers along side the list of integers sorted from the lowest to the highest.
7. Print a bar graph indicating how much each integer deviates from the mean. Use the sorted list of integers to develop the graph.
8. Label and print all of the above findings.
Your program must have separate functions to determine each of the following: mean, median, mode, standard deviation, reading of the original data, printing of the invalid records, printing of the valid records, number 6 and 7 above.
Your program will have its final test with the integers from the data file data6.txt.
Demonstrate your output in lab.
Submit your source code and algorithm or flowchart in blackboard.
All values must be clearly labeled in the output.
You are required to demonstrate your output in Lab.
Documentation will be 20% of your grade.
Your source code must contain the following documentation.
Header information: (Source Code and Output)
Your Name, course & section number, assignment number and due date.
A brief description of your assignment.
Variable dictionary: A brief description of every variable used in your program.
Comments related to input and output of data and all formulas used in your code.
Below is the shell used for the assignment
#include#include // Assignment 6 shell using namespace std; void readdata(ifstream &f1,int good[],char bad[][3], int &ctg, int&ctb); int main() { int good[40] = { 0 }, ctg = 0,ctb =0; char bad[20][3] = { ' '}; ifstream f1 ("h:\\data6.txt",ios::in); readdata(f1,good,bad,ctg,ctb); cout<< " good data "; for(int i = 0; i >ch1>>ch2, !f1.eof()) { cout << ch1 << ch2<< " "; if ( ch1>= '0' && ch1 <= '9' && ch2 >='0' && ch2 <='9') { good[ctg] = (int(ch1) - 48) * 10 + ( int (ch2) - 48); ctg++; } else { bad[ctb][0] = ch1; bad[ctb][1] = ch2; bad[ctb][2] = NULL; ctb++; } } }
Please complete in a way so that it can be copied and pasted c++, codeblocks
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started