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