c++ define constant

#include <iostream>
using namespace std;

#define PI 3.14159

int main() {
    cout << "The value of PI is: " << PI;
    return 0;
}
  1. We use the #include <iostream> directive to include the input/output stream library.
  2. using namespace std; allows us to use elements of the std namespace without using the std:: prefix.
  3. #define PI 3.14159 defines a constant named PI with a value of 3.14159.
  4. Inside the main() function, cout << "The value of PI is: " << PI; prints the value of the constant PI.
  5. The return 0; statement exits the main() function.