Also, avoid global variables, at least put them in main. They might not seem so bad in a small program, but before long they get out of hand. The golden rule is to keep the scope as small as possible.
Another golden rule is to always initialise your variables, preferably wait until you have a sensible value to assign to it, then do the declaration and assignment all in one statement. Otherwise initialise it to something valid but odd looking, for example
999.0
. Note zero is not always a good choice. I always put digits before and after the decimal place for doubles - it reinforces the idea that it is a double, and will never be interpreted by the compiler as an int. That can lead to integer division errors (not here though, just saying). The fact that you have two of your constants as ints does unnecessary implicit casts of those ints to double later in the program.
Try to choose good meaningful variable names.
NUMBER
is not such a good choice IMO, it's really a conversion factor because the units aren't metric. Similar idea for the other 2 constants, they are really the lower and upper limits for the BMI range
One more pedantic thing: One can build up a std::cout statement in stages, no need to do all in one hit:
1 2
|
cout << "You are overweight. It's okay to like your body, but stay healthy, too! ";
cout << "Exercise, it's good for you!" << endl;
|
Alternatively, you can have each line start with << :
1 2
|
cout << "You are overweight. It's okay to like your body, but stay healthy, too! "
<< "Exercise, it's good for you!" << endl;
|
One can split statements over several lines, all the compiler cares about is the semi-colon.
Hopefully this has been helpful :+)