Question
1) Grades with input validation (C++). Modify grade programs with arrays and functions. (the program should minimally have functions for average, min, max, # above
1) Grades with input validation (C++). Modify grade programs with arrays and functions. (the program should minimally have functions for average, min, max, # above average, etc. total of 4 functions) Add logic (to the main) so that if the user enters an invalid grade (lower than zero, higher than 100), the user will be issued an error message and then be allowed to reenter the grade. This will repeat as long as the user enters invalid grades. You will need a While loop. (See next slide for hints.) (filename = "grade-validation.cpp"). Include adequate testing and sample output. 2) Selection Sort (C++). Add selection sort function to grade program above. Program should display list of grades in sorted ascending order. (filename = "grade-sort.cpp"). Include testing and sample output. (Hint: do not modify the selection sort function in any way!!)
I need help in part 2 heres the selection sort function you cant change
void sort(double x[], int npts) { double min_value; int min_index; double temp; for(int i= 0; i and heres the code temp = x[min_index]; x[min_index] = x[i]; x[i] = temp; } return; } and here my code for the main function #include double average(double x[], int n); double maximum(double x[], int n); double minimum(double x[], int n); int nAboveAvg(double x[], int n); void sort(double x[], int npts); int main() { double grades[50]; int ngrades; cout<<"How many grades? (max = 50) "; cin>>ngrades; //create for loop to get grades from user for(int i = 0; i cout << "Average = " << avg << endl; cout << "# above average = " << nAbove << endl; cout<<"Max value is = "<
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