// using POW.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <math.h>
usingnamespace std;
int numberOfSeconds;
int numberOfMeters;
int acceleration = 32;
float sum;
int totalDistance;
int main ()
{
cout << "Enter the number of seconds the object should fall: ";
cin >> numberOfSeconds;
numberOfMeters = (acceleration * numberOfSeconds);
sum = pow(numberOfMeters, 2.0f);
totalDistance = sum/2;
cout << "The object will fall: ";
cout << totalDistance << endl;
return 0;
}
On a physical point of view on the other hand (nothing to do with programming), it seems to me there might be a flaw in the formula. Just look at the units : (acceleration (m.s^-2)*duration(s))^2 you'll get a result in m^2/s^2 --not a distance