Question
must use code blocks c++ Write a program that meets the following requirements: This assignment is to demonstrate the use of FUNCTIONS and ARRAYS .
must use code blocks c++
Write a program that meets the following requirements:
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.
data6.txt
31 02 99 1l 05 O5 76 33 34 B3 87 56 46 76 Il 75 65 93 65 01 02 05 98 11 12 73 15 19 ll lY 97 9l 76 81 87 45 43 76 69 23 35 31 37 ll pq 03 76 02
shell
#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++; } } }
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