-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMaxInt.cpp
More file actions
54 lines (41 loc) · 742 Bytes
/
MaxInt.cpp
File metadata and controls
54 lines (41 loc) · 742 Bytes
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
#include <iostream>
#include<string>
using namespace std;
int MaxInt(int ,int , int); //function prototype
int main()
{
int a,b,c;
string input;
do
{
cout << "Enter three integers\n"<< endl;
cin >> a >> b >> c;
cout<< "the maximum of number is : "<< MaxInt(a, b,c) << endl;
cout << "\nEnter 'y' if you want to enter the integers again. "<< endl;
cin >> input;
}while(input == "y");
return 0;
}
//int MaxInt(int x, int y, int z) //function definition
//{
// int max = x;
//
// if(y > max and y > z)
//
// return y;
//
// if(z > max and z > y)
//
// return z;
//
// return max;
//}
int MaxInt(int x, int y, int z) //function definition
{
int max = x;
if(y > max )
max = y;
if(z > max )
max = z;
return max;
}