Please help me understand what I'm doing wrong?
Need help understanding why the math is not outputting when I debug and I don't get any errors when I do so?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include <iostream>
#include <iomanip>
using namespace std;
double fallingdistance(double);
int main()
{
int seconds;
double distance;
seconds = 1;
distance = 0;
cout << "Seconds Distance" << endl;
cout << "=======================" << endl << endl;
for(seconds = 1; seconds > 12; seconds++)
{
distance = fallingdistance(seconds);
cout << seconds << " " << distance;
}
return 0;
system("pause");
}
double fallingdistance(double seconds)
{
double distance = .5 * 32.2 * seconds * seconds;
return distance;
}
Put the code you need help with here.
|
> for(seconds = 1; seconds > 12; seconds++)
Try it with < instead of >
> return 0;
> system("pause");
The system call is unreachable code, so it's not going to happen.
Gotcha once I switched it around I got it to work. I appreciate the help.
Topic archived. No new replies allowed.