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()
// ===================
|