Question: Write a C++ program that reads from the file HW4_Q1data.txt 30 integers in the range 0 200 . The program then determines the number of
Write a C++ program that reads from the file HW4_Q1data.txt 30 integers in the range 0 200 . The program then determines the number of integers in each of the following ranges: 0 - 24, 25 49, 50 74, 75 99, 100 124, 125 149, 150 174 , and 175 200 .Outputtheranges and the number of integers in each range. (Use the following values in the file HW4_Q1data.txt: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189, 137, 23, 192, 78).
Specifically, create the following functions:
-
void readData(char filename[], int list[], int size); This function reads from file filename and populates (or increments) the list array location belonging to each number from the file.
-
void print(int list[], int size); This function will print the ranges and the number of students that have scores in a particular range, as shown below.
1. Write a program that reads from the file HW4 Q1data.txt 30 integers in the range 0 200. The program then determines the number of integers in each of the following ranges: 0 24, 25 49, 50 74, 75 99 1000 124, 125 149 150 174, and 175 200. output the ranges and the number of integers in each range. (Use the following values in the file Hw4 Q1data.txt: 76, 89, 150 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 8 7, 9 129, 149, 176, 200, 87, 35, 157, 189, 137, 23, 192, 78 Specifically, create the following functions: void readData(char filename[], int list[], int size); This function reads from file filename and populates (or increments) the list array location belonging to each number from the file. void print (int list[], int size); This function will print the ranges and the number of students that have scores in a particular range, as shown below. Create the main to test your code. Sample output: TEACHINGW116 C. Programming HMVHWA Q1 exe" Range of Students 25 49 74 15 124 25 149 50 174 75 Process returned e (exe) execution tine 0.016 s Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
