fork download
  1. #include <iostream>
  2. using namespace std ;
  3.  
  4.  
  5. void print1() {
  6. cout << "enter the mass \n" << endl ;;
  7. }
  8.  
  9. double getmass() {
  10. print1() ;
  11. double m ;
  12. cin >> m ;
  13. return m ;
  14. }
  15. void print2() {
  16. cout << "enter the velocity \n" ;
  17. }
  18.  
  19. double getvelocity() {
  20. print2() ;
  21. double v ;
  22. cin >> v ;
  23. return v ;
  24. }
  25. void print3() {
  26. cout << "the KE = " ;
  27. }
  28.  
  29. double KE(double m , double v) {
  30. double ke = 0.5 * m * v * v ;
  31. print3() ;
  32. return ke ;
  33. }
  34.  
  35.  
  36.  
  37. int32_t main () {
  38. double mass = getmass() ;
  39. double vel = getvelocity() ;
  40. cout << KE(mass, vel) ;
  41.  
  42. return 0 ;
  43. }
Success #stdin #stdout 0.01s 5324KB
stdin
50
60
stdout
enter the mass 

enter the velocity 
the KE =  90000