#include <iostream>using namespace std; double eneryForMass( double m , double c ){double energy; energy = m*(c*c);cout << "the energy value for object of mass" << m << "is" << energy; << endl;} int main(){//declare variables double m ; double c = 2.99792458; cout << " please enter value for mass" ;cin >> m; cout>> energyForMass(); return 0;}
Standard input is empty
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.
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!