Question: Assignment: Query the user for grades from ten students and store them in a static array. Compute the letter grades for each student as described

Assignment: Query the user for grades from ten students and store them in a static array. Compute the letter grades for each student as described in the problem. Display the numeric and letter grades for each student.

This would be thee third time I've posted this problem here. I've been getting issues with the program each time somehow. Can someone help me get this to work! Any changes that are necessary to get this program to work would benefit me greatly. If it helps, I've been using Code Blocks for my code, so it'd be preferable if someone used that to fix my code. But whatever helps I'd appreciate!\

Here's my code:

#include #include using namespace std;

//Functions to find the mean, calculate standard deviation, and display results in rows/columns int find_mean(int *grades, int n); float find_stand_devi(int *grades, int n, int mean); void show_display(int *grades, int mean, int sd, int x);

int main(void) { int x; //Amount of grades total(10) int *grades; //Pointer to reference grades int arrayGrades[10];

//User input grades cout << "This program queries the user for ten numeric grades, calculates and displays them as letter grades." << endl; cout << "Enter 10 number grades: " << endl; for (x = 0; x < 10; ++x) { grades = arrayGrades; }

//Storing values in array for(int i = 0; i < x; i++) { cout << "Grade " << (i + 1) << ": "; cin >> grades[i]; }

//Calling functions for mean, standard deviation, and display int mean = find_mean(grades, x);

cout << "The mean is: " << mean << endl; // printing mean

int stan_d = find_stand_devi(grades, x, mean);

cout << "The standard deviation is: " << stan_d << endl; // printing standard deviation cout << "The letter grades of each numeric grade in user input order, using standard deviation, is as follows: " << endl;

show_display(grades, mean, stan_d, x);

return 0; }

//Function to find the mean int find_mean(int *grades, int x) { int y = 0;

for(int i = 0; i < x; i++) { y += grades[i]; } int mean = y / (x * 1);

return mean; }

//Function to find the standard deviation float find_stand_devi(int *grades, int x, int mean) { float sum = 0.0, standardDeviation = 0.0; int i;

for(i = 0; i < 10; ++i){

sum += grades[i]; }

mean = sum/10;

for(i = 0; i < 10; ++i) standardDeviation += pow(grades[i] - mean, 2);

return sqrt(standardDeviation / 10); }

//Function to display results in rows/columns void show_display(int *grades,int mean,int stan_d,int x) { for(int i = 0; i < x; i++) { if( grades[i] >= 0.5 && grades[i] < 1.5)

cout << "\t" << grades[i] << " = " << "D" << endl;

else if(grades[i] >= 1.5 * stan_d )

cout << "\t" << grades[i] << " = " << "A" << endl;

else if(grades[i] >= 0.5 * stan_d && grades[i] < 1.5 * stan_d)

cout << "\t" << grades[i] << " = " << "B" << endl;

else if(grades[i] >= 1.5 && grades[i] < 0.5 * stan_d)

cout << "\t" << grades[i] << " = " << "C" << endl; }

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!