Write a program that gives the user a menu of 8 options. The options are: Read i
ID: 3659031 • Letter: W
Question
Write a program that gives the user a menu of 8 options. The options are: Read in 10 scores (integers) from the user. Read in 10 scores from a file, scores.txt. Print the 10 scores. Print the highest score. Print the lowest score. Print the mean (average) of the 10 scores. Print a score based on an entry or row# and show how many scores are higher. Exit the program. You must store the scores in an array. The size of the array should be declared as a global constant. You should initialize the array to some value (probably 0) in case the user chooses options 3 - 7 before 1 or 2. Options 1 or 2 will overwrite any value previously stored in the array. Each option in the menu must simply call a function. Each function must at minimum pass in the array and the size of the array. Here is what I already have: #include #include #include using namespace std; int main() { const int ARRAY_SIZE = 10; int numbers[ARRAY_SIZE]; int count = 0; ifstream inputFile; inputFile.open("scores.txt"); while (count < ARRAY_SIZE && inputFile >> numbers[count]) count++; inputFile.close(); cout << "The numbers are: "; for (count = 0; count < ARRAY_SIZE; count++) cout << numbers[count] << " "; cout << endl; int max=0,min=99999; double sum=0.0,mean; for(int i=0;inumbers[i]) min = numbers[i]; sum = sum+numbers[i]; } mean = sum / ARRAY_SIZE; cout<<"Highest Score"<<" "; cout<<max<<endl; cout<<"Lowest Score"<<" "; cout<<min<<endl; cout<<"Mean"<<" "; cout<<mean<<endl; system("PAUSE"); return 0; }Explanation / Answer
#include #include using namespace std; void printScores(int scores [], int length); int highScore(int scores[], int length); int lowScore(int scores[], int length); double avg(int scores[], int length); int searchScore(int scores[], int length, int number); int main() { cin.clear(); start: int choice=0; int input; int i; int j; const int length = 10; int scores[length]; ifstream inputFile; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.