All submissions

Square with Macro and Inline Function

#include<iostream>
using namespace std;

#define SQUARE(X) ((X)*(X))

inline int square(int X)
{
 return X*X;
}

int main()
{
   int n;
   cin>>n;

   int a, b;
   a=n;b=n;
cout<<"Macro Square: "<<SQUARE(++a)<<endl;
cout<<"Inline Square: "<<square(++b)<<endl;
}
Loading...

Input

5

Expected Output

Macro Square: 49 Inline Square: 36