I have been trying to calculate velocity of satellite by formula v = -1/2 * GMm/r using c++ it compiled successfully but after getting all input it dies not show result and terminate abruptly. I tried to work around by re writing code again but all gone in vain.
 #include <iostream>
 using namespace std ;
 #define G 6.672 
 float calculate(float , float , float) ;
 int main(void)
 {
  float aa ;
  aa = (1/2) ;
  cout << aa ;
  cout << "Total energy of satellite " << endl ;
float ene ,m , M , r ;
cout << "Enter masses and radius " << endl ;
cin >> m  ;
cout << "2nd mass" << endl ;
cin >> M ;
cout << "radius " ;
cin >> r ;
ene = calculate(m ,M , r);
cout << ene ;
return 0 ;
system("PAUSE") ;
}
float calculate(float a , float b , float c)
{
      float result ;
      result = 0.5 * (G * a * b)/c ;
      return result; 
}
 
    