Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // CF_TR5_A
- #define _CRT_SECURE_NO_WARNINGS
- #define M_PI 3.1415926535897932384626433832795
- #include <iostream>
- #include <stdio.h>
- #include <fstream>
- #include <math.h>
- using namespace std;
- int main()
- {
- long double x, y;
- ifstream file_in("angle1.in");
- file_in >> x >> y;
- file_in.close();
- long double ang = 0;
- if ((x > 0) && (y >= 0)) ang = atan2(y, x);
- if ((x > 0) && (y < 0)) ang = atan2(y, x) + 2 * M_PI;
- if (x < 0) ang = atan2(y, x) + M_PI;
- if ((x == 0) && (y > 0)) ang = M_PI / 2;
- if ((x == 0) && (y < 0)) ang = 3 * M_PI / 2;
- ofstream file_out("angle1.out");
- file_out << ang;
- file_out.close();
- //system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement