example1_include_macros.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#include <iostream>
#include "myheader_1.h"

#define PI 3.14159
#define SQUARE(x) ((x) * (x))

int main() {
    double radius = 5.0;
    double area = PI * SQUARE(radius);
    
    std::cout << "Area of circle with radius " << radius << " is " << area << std::endl;
    
    return 0;
}
Back to preprocessing_directives