Urgent!! Summing scores after dropping max and min

I'm asked to compile a programme which sums 5 scores after discarding the highest and lowest score. Below is my programme but it doesn't show any output after inputting the 5 scores!!!!
Please can anyone help????


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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
  #include <iostream>

void findscore(int&, int&, int&, int&, int&);
void findsum(int&, int&, int&, int&, int&);
int findlowest(int, int, int, int, int);
int findhighest(int, int, int, int, int);



using namespace std;

int main()
{
	int s1, s2, s3, s4, s5, lowest, highest, sum;
	findscore(s1, s2, s3, s4, s5);
	findsum(s1, s2, s3, s4, s5);

}

void findscore(int& s1, int& s2, int& s3, int& s4, int& s5)
{
	cin >> s1;

	cin >> s2;

	cin >> s3;

	cin >> s4;

	cin >> s5;

}


int findlowest(int, int, int, int, int)
{
	int s1, s2, s3, s4, s5, lowest;
	findscore(s1, s2, s3, s4, s5);
	lowest = s1;

	if (lowest > s2)
    {
        lowest = s2;
    }

	if (lowest > s3)
    {
        lowest = s3;
    }

	if (lowest > s4)
    {
        lowest = s4;
    }

	if (lowest > s5)
    {
        lowest = s5;
    }

	return lowest;

}

int findhighest(int, int, int, int, int)
{
	int s1, s2, s3, s4, s5, highest;
	findscore(s1, s2, s3, s4, s5);
	highest = s1;

	if (highest < s2)
    {
        highest = s2;
    }
	if (highest < s3)
    {
        highest = s3;
    }
	if (highest < s4)
    {
        highest = s4;
    }
	if (highest < s5)
    {
        highest = s5;
    }
	return highest;

}

void findsum(int& s1, int& s2, int& s3, int& s4, int& s5)
{

	int lowest;
    int highest;
    int sum;

    lowest = findlowest(s1, s2, s3, s4, s5);
	highest = findhighest(s1, s2, s3, s4, s5);
	sum = (s1+s2+s3+s4+s5-lowest-highest);

	cout << sum;

}
1. Enter 15 integer values. Then your program will output something, because it asks three times for input (lines 15, 38, 68).

2. Have a look at your compilers warnings! You never use variables lowest, highest and sum.

3. Functions findlowest() and findhighest() doesn't define any parameter names. Its one of C/C++ curiosities allowing to define formal parameters without names. Both functions will operate on undefined values of their locally defined variables s1..s5.

4. A hint: main() should ever return a value. 0, which is commonly defined as EXIT_SUCCES, on success and something like EXIT_FAILURE otherwise.
4. A hint: main() should ever return a value. 0, which is commonly defined as EXIT_SUCCES, on success and something like EXIT_FAILURE otherwise.
In C++ main implicitely return 0 if not stated otherwise. You do not need explicit return statement.
In C++ main implicitely return 0 if not stated otherwise. You do not need explicit return statement.


Oh, many thanks! I didn't knew it.
Topic archived. No new replies allowed.