example1_basic_usage.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include <iostream>

namespace Mathematics {
    const double PI = 3.14159;
    
    double calculateCircleArea(double radius) {
        return PI * radius * radius;
    }
}

int main() {
    double radius = 5.0;
    std::cout << "Area of circle with radius " << radius << " is: "
              << Mathematics::calculateCircleArea(radius) << std::endl;
    return 0;
}
Back to namespace