>> Alt = time * velocity
It should be:
Alt_after_time_t = orig_alt - ( t * velocity )
May be if you clarify what are you trying to achieve, that'll help. If you have some problem statement post that...
Also the code is not compile clean. Update so others don't have to do compiler's work..
----------------------------------------------------------------
Few other things:
----------------------------------------------------------------
for(float z = 0.0; z < 5000; ++z)
time_++;
When you don't wanna increment in fractions don't use float, use int instead.
----------------------------------------------------------------
float lunar_lander::frate(float t)
{
for(float i = 0.0; i < 1; ++i)
frate_ = t;
return frate_;
} WHY ?! You can as well just do:
float lunar_lander::frate(float t)
{
frate_ = t;
return frate_;
} ----------------------------------------------------------------
// CORRECTS IF TIME GOES BELOW ZERO
float lunar_lander::time(float q)
{
time_ = 0.0;
time_ ++;
if (time_ <= 0.0)
{
time_ = 0.0;
}
} In the code time_ is neverdecresed, so how will it go below zero? Also float q is never used.
----------------------------------------------------------------
>> using namespace std;
In general it's not a good idea. Rule of thumb, if you donno why language provides "using namespace", don't use it.
It's definitely a VERY bad idea in header file.
----------------------------------------------------------------