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 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#include <iostream>
#include<cmath>
using namespace std;
double CalcVel(double d, double t, double v);
double CalcKin(double m, double v, double k);
int main(){
double d, t, m, k, v;
cout<<"Enter distance, time and mass"<<endl;
cin>>d>>t>>m;
v=CalcVel(d, t, v);
cout<<"The velocity is "<<v<<endl;
k=CalcKin(v, k, m);
cout<<"The kinetic energy is "<<k;
return 0;
}
double CalcVel(double d, double t, double v)
{
v=d/t;
return v;
}
double CalcKin(double m, double v, double k)
{
k=(1/2)*m* pow(v, 2);
return k;
}
|