I did the program but my teacher says i need to make a array in this program without messing with "int main" part expect for changing few variables in there, most of the work has to be done in "void input". we strated arrays a few days ago but its not clicking for me. The function for this program is to give the average grade from 3 grades and also shows the letter grade but with arrays i need for it to ask me for 10 grades "const int N=10;"
My working normal program(no array)
so can anyone please help me combine these simple programs
// Input (): get 10 grades from user into array
//Calculate (): find and return average of grades
//lettergrade():find and return lettergrade of average
//output(): display average and letter grade
//int main (){
// int grades[N]
// double averag;
// char letter;
#include <iostream>
usingnamespace std;
int main()
{
// Declare Variables
constint TOTAL_NUMBERS = 10;
int numbers[TOTAL_NUMBERS];
double average;
double sum = 0.0;
int num;
//Read all numbers
for (int i = 0; i < TOTAL_NUMBERS; i++)
{
cout << "Enter a score: ";
cin >> num;
numbers[i] = num;
sum += numbers[i];
}
//Find the average
average = sum/10;
// Display average
cout <<"\nThe average score is " << average <<"\n\n";
return 0;
}