I need for help

Can anybody to help with the Doppler effect programming in C++ code?
till now I can offer to you only this party:
w1 = w0*( 1 - v/c0 ) is the formulae.
w0 = wavelength of stable source (sound or light)
w1 = wavelength (of sound or light while moving toward source)
v = speed of movement toward source
c0 = speed of light 300000000 m/s or sound's speed 340 m/s

#include<iostream>
#include<cstdlib>
using namespace std;

int main()
{
int x,y,v,c,l;
// x = wavelength of sound or light while not moving
// y = wavelength of sound or light while the source is moving toward us
// v = speed of source's movement toward us
// c = speed of sound or light
cout << "How fast were you going while running stoplight? In m/s please";
cin >> v;
y = .034 m
x = .041
c = 340 m/s
y = x * (1 - v/c);
cout << "What was the speed limit? in m/s.";
cin >> l
if ( v > l )
cout << "You were speeding!";
system("pause");
}
Last edited on
you cannot do this way
1
2
3
y = ?
x = ?
c = ?

you have to have some values in that variables.
Topic archived. No new replies allowed.