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 #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 (0.5*g*time*time); return distance; }

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!