namespace called Constant

pls help me with my homework.

=> Create a namespace called constants that contains the following information.
This namespace will be used by programmers to access the values of the most commonly used constants

a. gravity = 9.8
b. pi=3.14
It looks like your class is already on namespaces. Good, then you have seen namespaces explained. Use that knowledge.

1
2
3
4
5
6
7
#include <iostream>

// insert your code here

int main() {
  std::cout << "full circle is " << 2 * constants::pi << " radians\n";
}
Topic archived. No new replies allowed.