/*...program that allows user to enter a time in seconds and then outputs
how far an object would drop if it is in freefall for that length of time.
Assumes there is not friction or resistance from the air, and a constant
acceleration of 32 feet per second
uses the equation:
distance = (acceleration * time^2)/2
*/
#include <iostream>
#include <cmath>
usingnamespace std;
int main()
{
double time = pow(time, 2.0);
double acceleration = 32; //feet per second
double distance = (acceleration * time)/2;
cout << "This is a program that calculates how far an object will fall in" << endl;
cout << "user specified seconds." << endl;
cout << "Enter the number of seconds." << endl;
cin >> time;
cout << endl << distance;
char letter;
cout << endl << "Enter a letter to end the program" << endl;
cin >> letter;
return (0);
}
I am working on my analytic/problem solving/critical thinking skills, so if you can resist, don't solve it for me. I'd rather have a hint or suggestion.
#include <iostream>
#include <cmath>
usingnamespace std;
int main()
{
double acceleration = 32; //feet per second
double time;
cout << "This is a program that calculates how far an object will fall in" << endl;
cout << "user specified seconds." << endl;
cout << "Enter the number of seconds." << endl;
cin >> time;
double timePow = pow(time, 2.0);
double distance = (acceleration * timePow)/2;
cout << endl << distance;
char letter;
cout << endl << "Enter a letter to end the program" << endl;
cin >> letter;
return (0);
}