1. ## 1 Question

Hi dears;

i have written a code for c++ . this code recieve n and then recieve n student grades ,,, and finally it finds the average of grades !

Code:
```#include <iostream>
#include <conio.h>
using namespace std;
int main(){
int n,count=0,sum=0;
cout << "How many students grade do you want to input ? \n" <<endl;
cin >> n;
cout << endl;

while (count<n){
cout << endl;
count++;
}
avg = (float)(sum)/(float)(n);

cout << avg;
getch();
return 0;
}```
but now i want to calculate the average of the "first (n-1) top grades ! "

now my idea : finiding the min grade between inputed grades and sustract it from sum ... but i dont exactly know how can i find it between inputed grades !!! can u help me ?? tnx;

2. Good idea

I will make you an example and from this you will be inspired to modify your code ( you see I am fair, I am not stealing you all the fun )

Code:
```#include <iostream>
using namespace std;

int main ()
{
int min,n;
cout << "Input number of elements" << endl;
// Input validation!
cin >> n;
cout << endl;
if( n <= 0 )
{
cout << "Non positive input.Exiting..." << endl;
return -1;
}

int array[n];

cin >> array[0];
cout << endl;
// we have only one element
// now, so this is the min
min = array[0];

for(int i = 1 ; i < n ; i++)
{
cin >> array[i];
cout << endl;
// if the element we read
// is smaller than min,
// then assign to min
// this element.

if( array[i] < min )
min = array[i];
}

cout << "min = " << min <<endl;
return 0;
}```
Hope this helps