-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMaximumOfTwoValues.cpp
54 lines (42 loc) · 1009 Bytes
/
MaximumOfTwoValues.cpp
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
/**
* \file MaximumOfTwoValues.cpp
* \brief
*
* \review
*/
#include <StdStream/StdStream.h>
#include <StdTest/StdTest.h>
#include <Stl.h>
//--------------------------------------------------------------------------------------------------
template <typename T>
const T &
maximum(const T &a, const T&b)
{
return (a > b) ? a : b;
}
//--------------------------------------------------------------------------------------------------
int main()
{
{
int i = 78;
int j = 89;
std::cout << "maximum(i, j) = " << maximum(i, j) << std::endl;
}
{
double a = 7.89;
double b = 3.56;
std::cout << "maximum(a, b) = " << maximum(a, b) << std::endl;
}
{
std::string s1 = "Hello";
std::string s2 = "World";
std::cout << "maximum(s1, s2) = " << maximum(s1, s2) << std::endl;
}
return EXIT_SUCCESS;
}
//--------------------------------------------------------------------------------------------------
#if OUTPUT
maximum(i, j) = 89
maximum(a, b) = 7.89
maximum(s1, s2) = World
#endif