Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- #define PI 3.1415926535
- int getAngle(double x, double y){
- double fi = atan2( y , x);
- if (fi > 0){
- return (int) (fi * (180.0 / PI));
- } else {
- return 360 + (int) (fi * (180.0 / PI));
- }
- }
- int main() {
- double x = -1;
- double y = -1;
- cout << getAngle(x, y) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment