Question: Can anyone show me what is wrong? Running /home/ubuntu/workspace/fallingDistance.cpp /home/ubuntu/workspace/fallingDistance.cpp: In function int main(): /home/ubuntu/workspace/fallingDistance.cpp:17:1: error: KE was not declared in this scope KE =
Can anyone show me what is wrong?
Running /home/ubuntu/workspace/fallingDistance.cpp /home/ubuntu/workspace/fallingDistance.cpp: In function int main(): /home/ubuntu/workspace/fallingDistance.cpp:17:1: error: KE was not declared in this scope KE = kineticEnergy(mass,velocity); ^
Process exited with code: 1
C++ code is below
#include
using namespace std;
double fallingDistance(int); double kineticEnergy(double, double); int main() {
int t; double distance, time, mass, velocity;
cout << " Enter time of falling object: " << endl; cin >> time;
KE = kineticEnergy(mass,velocity);
cout << "Kinetic Energy for system is: " << KE<< endl;
for(t=1;t<=time;t++) { distance=fallingDistance(t);
cout<<"At SEC: "< system("pause"); return 0; } //function definition double fallingDistance (int time) { double distance, g=9.8; distance = static_cast double kineticEnergy (double mass,double velocity) { cout << "Enter Mass of body: "; cin >> mass; cout << "Enter Veolicty of body: "; cin >> velocity; double KE; KE = (0.5*mass*velocity*velocity); return KE; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
