(Header.h)
#ifndef CONSTANTS_H
#define CONSTANTS_H
namespace constants
{
int x;
int radius(x);
constexprdouble pi(3.14159);
constexprdouble avogadro(6.0221413e23);
constexprdouble my_gravity(9.2);
}
#endif
(source code)
#include <iostream>
#include "Header.h"
usingnamespace constants;
usingnamespace std;
int main()
{
int radius(x);
double circumference = 2 * radius * pi;
cout << "What is the radius of that dang circle you want to know if you have enough gas money to go round trip? ";
cin >> x;
cout << "The dang route you need to take is " << circumference << " long." << endl;
cin.ignore();
cin.ignore();
return 0;
}
Don't put what are essentially local variables in your constants namespace.
I'm not sure what you think int radius(x) is doing. x is uninitialized, remember.
Then you put a calculation of circumference before you read in the radius (actually you read in x and seem to expect that to influence radius that then goes back in time and calculates circumference, or maybe you're thinking the calculations work like on a spreadsheet?).