fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. double eneryForMass( double m , double c ){
  5. double energy;
  6. energy = m*(c*c);
  7. cout << "the energy value for object of mass" << m << "is" << energy; << endl;
  8. }
  9. int main(){
  10. //declare variables
  11. double m ;
  12. double c = 2.99792458;
  13.  
  14.  
  15.  
  16.  
  17. cout << " please enter value for mass" ;
  18. cin >> m;
  19. cout>> energyForMass();
  20.  
  21. return 0;
  22. }
  23.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:7:71: error: expected expression
cout << "the energy value for object of mass" << m << "is" << energy; << endl;
                                                                      ^
prog.cpp:19:8: error: use of undeclared identifier 'energyForMass'
cout>> energyForMass();
       ^
2 errors generated.
stdout
Standard output is empty