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,a,b;
   cin >> n;
   // your code here: declare variables a and b, initialize with n
   // your code here: call macro and inline function using ++a and ++b
   // your code here: print results
   a=n;
   b=n;
   cout<<"Macro Square: "<<SQUARE(++a)<<endl;
   cout<<"Inline Square: "<<square(++b);
   return 0;
}
Loading...

Input

5

Expected Output

Macro Square: 49 Inline Square: 36