Quote:
#include <iostream>
using namespace std;
int main ()
{
double distance, lightspeed, delay, delay_in_min, seconds;
int delay_in_min_2;
/* i added int delay_in_min_2; to calculate the seconds left after the whole minutes (minutes-minutes rounded)*60 */
distance = 34000000.0;
lightspeed = 186000;
delay = distance/lightspeed;
cout << "Time delay when talking to mars: " << delay << " seconds." << endl;
delay_in_min= delay/60.0;
cout << "This is " << delay_in_min << " minutes." <<endl;
seconds = (delay_in_min-delay_in_min_2)*60;
// [Warning ] converting to int from double. how to do it else?
delay_in_min_2= ((distance/lightspeed)/60);
cout << "Time delay when talking to mars: " << delay_in_min_2 <<" minutes and " << seconds <<endl;
system ("pause");
return 0;
}
edit: oops wrong title i mean mars. xD