# include <iostream >
# include <cmath>
using namespace std;
int main ()
{
double speed_of_light,distance,time ;
bool x ;
cout << "please note all data in units of SI" << " \n"<< " would you like to enter the value of speed of light ?" << " \n" << "reply in 1 for yes and 0 for no " ;
cout << " \n " ; cin >> x ;
if ( x = 1 , cout << " please enter the value of speed of light : ",
cin >> speed_of_light ,cout << " \n " << " please enter the distance: ", cin >> distance );
else if ( x = 0 , speed_of_light = 300000000);
time = distance / speed_of_light;
cout << " the time needed is :" << time ;
cin.ignore ( 256 , '/n' );
cout << " press enter to continue " << endl ;
cin.get () ;
return 0;
}
p.s i use dev c ++
Admin Edit: Please use code tags when posting your code. Code tags are used like so =>
Thanks,
PsychoCoder

New Topic/Question
Reply
MultiQuote








|