Removing highest and lowest

i have written a program that accepts 8 numbers inputted by the user and it determines the highest and lowest value what i need to do next is to display the inputted values without the highest and the lowest value

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>

using namespace std;

int main()
{
    string judges[8]={"Judge 1: ","Judge 2: ","Judge 3: ","Judge 4: ","Judge 5: ","Judge 6: ","Judge 7: ","Judge 8: "};
    double score[8];
   int maxindex=0,minindex=0;
    double highest=0;
    double lowest=999999;

    for (int x=0;x<8;x++)
        {

        cout<<judges[x];
        cin>>score[x];

        }
        for (int x=0;x<8;x++)
            cout<<score[x]<<'\t';
        for (int z=0;z<8;z++)
        {
            if (score[z]>highest)//32<1
            {highest=score[z];
            maxindex=z;

            }
            if (score[z]<lowest)//1 <32

            {
                lowest=score[z];
                    minindex=z;
            }
        }
        cout<<endl;
        cout<<"highest= "<<highest<<endl;
        cout<<endl;
        cout<<"lowest= "<<lowest<<endl;

        cout<<score[maxindex]<<endl;
        cout<<score[minindex]<<endl;


}
Last edited on

loop through the scores and if the number doesn't match both highest and lowest then show it to the console, otherwise move to the next number in score.
im already able to remove the highest and the lowest value what im trying to do next is to calculate the average of numbers without the highest and the lowest values :D
can you please help me
closed account (48T7M4Gy)
Get the total of all the numbers, subtract the highest and lowest, and then calculate the average by dividing this final total by the number of scores less 2.
thanks for the feedback's i was already to finish it :D
Topic archived. No new replies allowed.