YOU CANNOT USE THIS following things in the HEADER FILE. any function in header
ID: 3769020 • 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>
#include <math.h>
using namespace std;
int main(){
ifstream infile;
string s;
cout << "Enter the File Name " << endl;
cin >> s;
infile.open(s.c_str(),'r');
int x;
float sum = 0.0;
int min = 101; // Minimum
int max = -1; // Maximum
int n = 1;
while(cin >> x){
sum += x;
n += 1;
if (min > x) min = x;
if (max < x) max = x;
}
float mean = sum/n; // Mean
infile.close();
infile.open(s.c_str(),'r');
float devation = 0.0;
while (cin >> x){
devation += ((x - mean)*(x-mean))/n;
}
devation = sqrt(devation);
infile.close();
ofstream outfile;
outfile.open("output.txt");
outfile << "Mean is : " << means << endl;
outfile << "Standard Deviation is : " + devation << endl;
outfile << "Maximum is : " << max << endl;
outfile << "Minimum is : " << min << endl;
outfile << "Range is : " << max - min << endl;
outfile.close();
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.