Distance Over Time Source Code

//
//  main.cpp
// 

#include <iostream>
#include <math.h>
#include <cmath>
using namespace std;
 
int main()
{
    double movtime;
    double Acceleration;
    double distance;
 

    cout << "Please input time (in seconds)";
    cin >> movtime;

    cout << "Please input acceleration (in feet)";
    cin >> Acceleration;

    if(movtime >= 0){
        distance = (Acceleration * (pow(movtime , 2.0) ))/ 2;

        cout<<"this is how far the object fell " <<distance<< " ft" << endl; 
    }
    return 0;
}

Leave a Reply