I'm working on an assignment and I cant tell what I'm doing wrong. could someone help me out? I'm very new to C++ This is my second program
Code
Program #1
According to Einstien's Special Theory of Relativity, time passes slower with reference to a moving object. The faster you go, the slower time gets from your reference point. He also theorized that if you travel the speed of light, time stops and if you go faster, you can go back in time (he also proved you cannot go the speed of light). But, you can approach the speed of light.
Use the following algorithm to write a program that gives us the values of time passing on a moving clock vesus a stationary clock (declare everything as a double).
insert your class header info
include pre-processor directives (along with <iostream>, you will need to #include <cmath> for the sqrt())
declare speed of light constant const double c= 299792458
main()
declare identifiers
prompt for time of travel (tm)
read time on moving clock
check for valid input (time of trip > 0)
prompt for velocity (v)
read velocity (a percent of light speed. a number between 0 and 100)
check for valid input (velocity > 0 and less than 100)
Make sure that after you enter the velocity (v), do the following equation
v = (v / 100) * c;//this changes the velocity to a percent of light speed
calculate time on stationary clock using the following
ts = tm/(sqrt(1-(v*v)/(c*c)));
where
ts = time of stationary clock
tm = time of moving clock
v = velocity (remember, this is a % of light speed so make sure you multiply v * c)
c = speed of light
print results (see below)
prompt the user to enter another set of data. If the user enters 'y' do it all over again. If he enters 'n', stop processing
loop for another set of data
pause
return
end of main()
and this is what I have so far
#include <iostream>
#include <cmath>
using namespace std;
const double c= 299792458;
int main()
{
double ts, tm, v, vv, c;
c=299792458;
cout << "Please enter time of travel: ";
cin >> tm;
cout << "Please enter velocity: ";
cin >> v;
ts=(tm/(sqrt(1-(vv *vv)/(c*c))));
vv =(v/100)*c;
cout << "the time of the stationary clock is: << "ts " <<endl;
system("pause");
return 0;
}
What am I missing here?