Write a program of macro with conditional statement


 

/* Write a program of macro with conditional statement.*/

#include<iostream.h>

#include<conio.h>

#define getmax(a,b)((a)>(b)?(a):(b))

void main()

{

int x=5,y;

clrscr();

y=getmax(x,2);

cout<<y<<endl;

cout<<getmax(7,x)<<endl;

getch();

}

output:

5

7

Related Posts

Comments are closed.