i am trying to write a program using atan

I cant figure out to set this up using atan?.

#include <iostream>
#include <cmath>


{
float d;

cout<< "This program is going to show you the angle of a person looking at the top of a 100ft tower.\n";
cout<< "In order for me to find the angle i would like to know how far the person is for the tower. Will you tell me? \n";

cin>> d;

cout<< "The angle the person is looking is:";
cout<< tan (100/d);






ststem ("pause");
return 0;
}
You used tan(100/d) instead of atan(100/d). You could also use atan2(100,d)
closed account (o3hC5Di1)
Hi there,

I'm not entirely sure what you're after, but perhaps the examples on these pages can help:

http://www.cplusplus.com/reference/cmath/atan/
http://www.cplusplus.com/reference/cmath/atan2/

Hope that helps.

All the best,
NwN
Topic archived. No new replies allowed.