YOU CANNOT USE THIS following things in the HEADER FILE. any function in header
ID: 3772253 • Letter: Y
Question
YOU CANNOT USE THIS following things in the HEADER FILE.
any function in header file <algorithm>
array class in header file <array>
complex class, or any function in the header file <complex>
deque class in header file <deque>
iterator class in header <iterator>
list class in header file <list>
map class in header file <map>
queue class in header file <queue>
set class in header file <set>
stack class in header file <stack>
any function in the header file <utility>
any function in the class <random>
vector class in header <vector>
Project objective: write a program that takes a list of final scores for a class and determines: 1) the mean (Greek letter mu)2) the standard deviation (Greek letter sigma). and 3] the number of grades in each category (A. A-, B+, B-, C+. C, C-, D+, D an Use the following formulas for the standard deviation and mean, respectively. (zi-A)2, where = N .ri 2- 2- Prompt the user for the name of a file containing the final scores, up to 100 scores, such as (without the commas): 100, 94, 59,83,57,11,92,76,37,89, 74, 59,65,79, 49,89,89,75, 64, 82, 15, 74, 82, 68, 92,61,33,95, 91,82,89,64, 43, 93, 86, 65, 72, 40, 42,90, 81,62,90,89,35,81,48,33,94,81,76,86,67, 70, 100, 80, 83, 78,96, 58 Note: m=71.47 s= 20.98 Determine the maximum score, the minimum score, the range of scores (maximum - minimum) and a table with column headings: Grade Number of scores using the following scoring (where m is the mean, s is the standard deviation, and x is an individual score): Place the output in a file, in an orderly format, and inform the user of the name of the file before exiting,Explanation / Answer
#include <iostream.h>
#include <math.h>
#include <fstream.h>
#include <iomanip.h>
#include <stdlib.h>
float deviation(float sum, float mean, float N);
float mean(float vector[], int size);
float sum(float vector[], int size);
int main()
{
ifstream inFile;
float N;
int size = 0;
const int Numlist = 1000;
float totalSum;
float avg = 0.0;
int max = 100;
int min = 11;
double m = 71.47;
double s = 20.98;
double List[Numlist];
inFile.open("input.txt");
if (inFile.fail())
{
cout << "Error: could not open input.txt" << endl;
exit(EXIT_FAILURE);
}
for (int count = 0; count < Numlist; ++count){
inFile >> List[count];
if (!inFile)break;
}
float standard_deviation[100];
inFile >> N;
while ((!inFile.eof()) && (size<Numlist))
{
standard_deviation[size] = N;
size++;
inFile >> N;
}
totalSum = sum(standard_deviation, size);
avg = mean(standard_deviation, size);
cout << "Standard Deviation = " << deviation(totalSum, avg, size) << endl;
cout << "Mean = " << avg << endl;
cout << "Maximum Score = " << max << endl;
cout << "Minimum Score = " << min << endl;
cout << "Range = " << (max - min) << endl;
cout << "Grade" << " " << "Number of Scores" << " " << endl;
system("pause");
return 0;
}
//-----------------------------
//Sum Function
//-----------------------------
float sum(float vector[], int size)
{
float theSum;
theSum = 0.0;
for (int N = 0; N < size; N++)
{
theSum += vector[N];
}
return theSum;
}
//-----------------------------
//Mean Function
//-----------------------------
float mean(float vector[], int size)
{
float sum = 0.0, mean = 0.0;
for (int i = 0; i < size; i++)
{
mean += vector[size];
}
if (size == 0)
mean = 0.0;
else
mean = mean / size;
return mean;
}
//-----------------------------
//Deviation function
//-----------------------------
float deviation(float sum, float mean, float N)
{
double S;
double U;
U = (pow(sum - mean, 2));
S = (sqrt(U / N));
return S;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.