Code:
#include <iostream>
#include <cmath>
#define pi 3.14159
using namespace std;
int main(){
float base, x, angle, el, height;
cout << "Enter the distance from WT: ";
cin >> base;
cout <<"Enter the eye level from ground: ";
cin >> el;
cout << "Enter the angle of elevation: ";
cin >> angle;
x = base*tan(angle* pi/180); //value of tan() should be converted in radians
height = x+el;
cout << "The height of the wind turbine is " << height << "m";
}
#include <iostream>
#include <cmath>
#define pi 3.14159
using namespace std;
int main(){
float base, x, angle, el, height;
cout << "Enter the distance from WT: ";
cin >> base;
cout <<"Enter the eye level from ground: ";
cin >> el;
cout << "Enter the angle of elevation: ";
cin >> angle;
x = base*tan(angle* pi/180); //value of tan() should be converted in radians
height = x+el;
cout << "The height of the wind turbine is " << height << "m";
}
Output:
Enter the distance from WT: 150
Enter the eye level from ground: 2
Enter the angle of elevation: 25
The height of the wind turbine is 71.9461m
Process returned 0 (0x0) execution time : 6.815 s
Press any key to continue.