# Answer to Question #11726 in C++ for temesgen

Question #11726

the acceleration of a sleigh sliding down a hill is a=g sin (a), where a is the slope of the hill and the gravity acceleration g=9.8 m/s2.

a) write a c++ function that calculates the acceleration as a function of the slope a in degrees.

b)write a c++ program that reads the slope and length of the hill as inputs,and calculates how long time it takes to slide down the hill.

a) write a c++ function that calculates the acceleration as a function of the slope a in degrees.

b)write a c++ program that reads the slope and length of the hill as inputs,and calculates how long time it takes to slide down the hill.

Expert's answer

a) write a c++ function that calculates the acceleration as a function of the slope a in degrees.

double acc(double a){

return 9.8*sin(a);

}

b)write a c++ program that reads the slope and length of the hill as inputs, and calculates how long time it takes to slide down the hill.

# include<iostream.h>

# include<conio.h>

# include<math.h>

double a, l;

double time(double a, double l){

return sqrt(2*l/a);

}

void main(){

cout<<"Enter the length of the hill (in meters): ";

cin>>l;

cout<<"Enter the slope of the hill (in degrees): ";

cin>>a;

cout<<"It takes "<<time(a, l)<< " seconds to slide down the hill.\r\n";

getch();

}

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment