I need help with this c++ question please
thank you
Note: Could you plz go this code and let me know if u
need any changes in this.Thank You
_________________
#include<iostream>
using namespace std;
//function declarations
double calcAverage(int nos[]);
int findLowest(int nos[]);
int getScore();
int main()
{
// Declaring and initializing an array
int nos[5];
//Getting the inputs entered by the user
for (int i = 0; i < 5; i++) {
nos[i] = getScore();
}
//Displaying the average
cout<<"Average of four highest scores :"<< calcAverage(nos)<<endl;
return 0;
}
//This function will calculates the average of numbers
double calcAverage(int nos[]) {
int lowest = findLowest(nos);
int sum = 0;
for (int i = 0; i < 5; i++) {
sum += nos[i];
}
sum -= lowest;
return ((double) sum / (4));
}
//This function will find the lowest of nos
int findLowest(int nos[]) {
int min = nos[0];
for (int i = 0; i < 5; i++) {
if (min > nos[i]) {
min = nos[i];
}
}
return min;
}
//This function will get and return the valid number
int getScore() {
int number;
while (true) {
cout<<"Enter a number :";
cin>>number;
if (number <= 0 || number > 100) {
cout<<"** Invalid.Must be between 1-100 **"<<endl;
} else {
break;
}
}
return number;
}
_____________________
Output:
__________Could you plz rate me well.Thank You
I need help with this c++ question please thank you ltls. The program should urt valte....
Lowest Score Drop In Functions, there can only be one return statement. You can not use an exit or break function. Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions: void getScore() should ask the user for a test score, store it in a reference parameter variable, and validate it. This function should be called by main once for each of...
Using basic c++ write 2 separate codes for this assignment. Program #1 Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions. • void getScore() should ask the user for a test score, store it in the reference parameter variable, and validate it. This function should be called by the main once for each of the five scores to be entered. •...
A particular talent composition has 5 judges, each of whom awards a score between 0 and 10 to each performer. Fractional scores, such as 8.3, are allowed. A performer's final score is determined by dropping the lowest and the highest score received, then averaging the 3 remaining scores. Write a program that uses this method to calculate a contestant's score. It should include the following functions: double getJudgeData() should ask the user for a judge's score and validate the score....
c plus plus determines which of 5 geographic regions within a major city north south east west and central had the fewest reported traffic accidents last year it should have the following function which are called by main int get NumAccidents is passed the name of a region it asks the user for the number of traffic accidents reported in that region during the last year validates the input then returns it. it should be called once for each city...
Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Design the following functions in the program: calcAverage—This function should accept five test scores as arguments and return the average of the scores. determineGrade—This function should accept a test score as an argument and return a letter grade for the score (as a String), based on the following grading scale: Score Letter Grade...
c++ Instructions Overview In this programming challenge you will create a program to handle student test scores. You will have three tasks to complete in this challenge. Instructions Task 1 Write a program that allocates an array large enough to hold 5 student test scores. Once all the scores are entered, the array should be passed to a function that sorts them in ascending order. Another function should be called that calculates the average score. The program should display the...
Please Write in C++ (10-30) @ 11:55pm 1.9 HW7 This homework assignment gives you the opportunity to practice functions, functions that call other functions, reference variables, logical statements (what is meant by logical statement is a statement such as if, if/else if, switch), and input validation, HW7 (Graded out of 100) A talent competition has 5 judges, each of whom awards a score between 0 and 10 for each performer. Fractional scores, such as 8.3, are allowed. A performer's final...
read it carefully C++ Question: Write a program that dynamically allocates an array large enough to hold a user-defined number of test scores. Once all the scores are entered, the array should be passed to a function that sorts them in ascending order. Another function should be called that calculates the average score. The program should display the sorted list of scores and averages with appropriate headings. Use pointer notation rather than array notation whenever possible. Input Validation: Do not...
Write a program that dynamically allocates an array in the freestore large enough to hold a user defined number of test scores as doubles. Once all the scores are entered, the array should be passed to a function that finds the highest score. Another function the array should be passed to a function that finds the lowest score. Another function should be called that calculates the average score. The program should show the highest, lowest and average scores. Must use...
Write a program that dynamically allocates an array in the freestore large enough to hold a user defined number of test scores as doubles. Once all the scores are entered, the array should be passed to a function that finds the highest score. Another function the array should be passed to a function that finds the lowest score. Another function should be called that calculates the average score. The program should show the highest, lowest and average scores. Must use...