Here is the source code of the C++ program computes the maximum value using macros. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below.
* C++ Program to Find Maximum Value using Macros
#define MAX(a, b) (a > b ? a : b)
int a = 10, b = 20, c = -30;
std::cout << "MAX(10, 20) = " << MAX(a, b)
std::cout << "MAX(-30, 20) = " << MAX(c, b)
$ a.out Maximum of 10 and 20 = 20 Maximum of -30 and 20 = 20
Sanfoundry Global Education & Learning Series – 1000 C++ Programs.