# FIXING CODE

Posted 26 November 2019 - 05:01 PM

i was given this code in order to fix it with the least amount of change. can someone help me out please? Thank you

```//Maximum amount of students
const int MAX_SEAT_COUNT = 30;

//Returns students count for ongoing term
int get_Student_Count();

//Gets student scores from keyboard, validates the input
void getScores(double[],int);

//Returns average score
//double getAvgScore(double[], int);

//Returns 'A' to 'F' grade for average score
//A = [90,100] B =[80,90] C = [70,79] D = [60,69] F = [0,59]
//Must use a Reference variable to return the average grade

int main ()
{
double scores [MAX_SEAT_COUNT];
int n = getStudentCount();

getScores(scores,n);

int avgScore = getAvgscore(scores,n);
cout << " The average score is " << avgScore << endl;

cout << " The average grade is " << avgGrade << endl;

return 0;
}

int getStudentCount (){
do{
cout << "Please enter students count" << endl;
cin >> n;
}while ( n > MAX_SEAT_COUNT || n <= 0);
int n = 0;

Return n;
void getScores (double scores [], int n){
for (int i = 0; i < n; i++){
do{
cout << "Enter score for student " << i + 1 << endl;
cin >> scores [i];
}while (scores [i] > 0 && scores [i] > 100);
}
}

double getAvgScore(double scores[]){
double avg = 1;
for (int i = 0; i < MAX_SEAT_COUNT; i++){
avg += scores [i];
}

avg = avg / MAX_SEAT_COUNT;

return avg;
}

if (avgScore <60){
}
else if (avg Score <70){
}
else if (avgScore <80){
}
else if (avgScore < 90){
}
}
```

Is This A Good Question/Topic? 0

## Replies To: FIXING CODE

### #2 jimblumberg Reputation: 5780
• Posts: 17,684
• Joined: 25-December 09

## Re: FIXING CODE

Posted 26 November 2019 - 05:06 PM

What have you tried?

What seems to be wrong with the code you were supplied?

Does it compile without errors or warnings. Note: the code you supplied should not compile since it seems to be missing some required header files.

Lastly for now, the indentation is horrible. The first thing you should do is properly format the code so that it is easier to read.

Jim

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }