Hi, I'm trying to write a code to read the input of a towers height and then calculate how long it would take an object to hit the ground. I need to ask the user for what time intervals they would like(i.e every second, half-second, or tenth-second. It will then display the current height of the falling object as well as the time the object has fallen.
This is what I have so far and it doesn't want to compile. Can someone tell me and explain what I am doing wrong.
What are your compile errors? This is the first thing you must tell us when you ask about errors.
I'm actually surprised it doesn't run with undefined behavior. It should run but maybe you compiler is saving you in this case. On line 9, when you initialize distance, what is distance going to be?
Yes, why don't you initialize your variables before using them? It seems you are trying to tell the computer what you want it to do instead of how to do it... :)
You need to update distance *inside* the loop...