macro preprocessor directive in C++

PHOTO EMBED

Tue Jan 03 2023 01:30:20 GMT+0000 (Coordinated Universal Time)

Saved by @berasumit611 #c++

/*
 Author:	Internshala
 Module:	Diving into C++ Programming
 Topic:		Preprocessor Directives
*/

#include <iostream>
using namespace std;

#define UPPER_LIMIT 10		// Macro definition
#define AREA(r) (3.14 * r * r)	// Macro with parameter


int main() {

	// Find even numbers from 1 to 10.
	for (int i = 1; i <= UPPER_LIMIT; i++) {

		if (i % 2 == 0)
			cout << i << endl;
	}

	// Find the area of a circle.
	cout << "Area: " << AREA(5);		// 3.14 * 5 * 5

	return 0;
}
content_copyCOPY

https://github.com/Internshala-Online-Trainings/programming-with-c-and-cpp-v2/blob/master/m4-diving-into-cpp-programming/t4-preprocessor-directives/macro.cpp