Min Max median Help.

I have a project that i need to do for a class that requires the program to give out the Min, Median and Max of the three integers the user inputs. I am a bit confused on the parameters and don't under stand the "redefinition of parameter _" on line 57, 77 and 95. How do i go about fixing this problem and making the program run as intended. Any help would be much appreciated.

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
106
107
108
109
110
#include "stdafx.h"
#include <iostream>

using namespace std;

int  GetInteger();
int  Max(int, int, int, int);
int  Min(int, int, int, int);
int  Middle(int, int, int, int);
void Print(int, int, int);


int main()
{
	int n1, n2, n3 = 0;
	
	n1 = GetInteger();
	n2 = GetInteger();
	n3 = GetInteger();

	int min = Min(n1, n2, n3, min);
	int middle = Middle(n1, n2, n3, middle);
	int max = Max(n1, n2, n3, max);

	Print(min, middle, max);

    return 0;
	
	}// Function Main()
// ====================


void Print(int min, int middle, int max) {

	cout << endl;
	cout << "Min Value    ==> " << min << endl;
	cout << "Middle Value ==> " << middle << endl;
	cout << "Max Value    ==> " << max << endl;

	}//  Function Print()
//  =====================

int GetInteger() {

	int intValue;

	cout << "Enter an three integers ==> ";
	cin >> intValue;

	return intValue;

	}//  GetInteger()
//  =================

int Min(int p1, int p2, int p3, int min) {

	int min;

	min = p1;

	if (p1 > p2)
		min = p2;
	else
		min = p1;

	if (p3 < min)
		min = p3;

	return min;

	}//  Function Min()
//  ===================

int Middle(int p1, int p2, int p3, int middle) {

	int middle;

	middle = p1;

	if (p1 > p2)
		middle = p2;
	else
		middle = p1;

	if (p3 > middle)
		middle = p3;

	return middle;

	}//  Function Max()
//  ===================

int Max(int p1, int p2, int p3, int max) {

	int max;

	max = p1;

	if (p1 < p2)
		max = p2;
	else
		max = p1;

	if (p3 > max)
		max = p3;

	return max;

	}//  Function Max()
//  =================== 
All you need to do is to delete line 57,76,95
It says uninitialized local variable on line 21, 22 and 23?
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
#include <iostream>

int  GetInteger();
int  Max(int p1, int p2, int p3 ); // max of three integers p1, p2, p3
int  Min(int, int, int );
int  Middle(int, int, int );
void Print(int, int, int);

int main()
{
	const int n1 = GetInteger();
	const int n2 = GetInteger();
	const int n3 = GetInteger();

	const int min = Min(n1, n2, n3);
	const int middle = Middle(n1, n2, n3);
	const int max = Max(n1, n2, n3);

	Print(min, middle, max);

}// Function Main()
// ====================

void Print(int min, int middle, int max) {

	std::cout << "\nMin Value    ==> " << min
	          << "\nMiddle Value ==> " << middle
	          << "\nMax Value    ==> " << max << '\n';

}//  Function Print()
//  =====================

int GetInteger() {

	int intValue;

	std::cout << "Enter an integer ==> ";
	std::cin >> intValue;

	return intValue;

}//  GetInteger()
//  =================

int Min(int p1, int p2, int p3 ) {

	int min = p1 ;
	if (min > p2) min = p2;
	if (min > p3) min = p3 ;

	return min;
}//  Function Min()
//  ===================

int Middle(int p1, int p2, int p3 ) {

    return (p1+p2+p3) - Max(p1,p2,p3) - Min(p1,p2,p3);
}//  Function Max()
//  ===================

int Max(int p1, int p2, int p3 ) {

	int max = p1 ;
	if (max < p2) max = p2;
	if (max < p3) max = p3 ;

	return max;
}//  Function Max()
//  =================== 
Topic archived. No new replies allowed.