Answer to Question #99404 in C++ for Caleb

Question #99404
Simple geometry can compute the height of an object from the object's shadow length and shadow angle using the formula: tan(angleElevation) = treeHeight / shadowLength.
1. Using simple algebra, rearrange that equation to solve for treeHeight. (Note: Don't forget tangent).
2. Complete the below code to compute treeHeight. For tangent, use the tan() function, described in the "math functions" link above.
1
Expert's answer
2019-12-12T15:59:33-0500
#include <iostream>
#include <cmath>


using namespace std;


int main()
{
    float treeHeight, shadowLength, angleElevation;
    cout << "Enter the length of shadow: ";
    cin >> shadowLength;
    cout << "Enter the angle of elevation in radians: ";
    cin >> angleElevation;
    treeHeight = shadowLength * tan(angleElevation);
    cout << "Height of tree = " << treeHeight;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS