Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- #define pi 3.14159265358979
- class Polar
- {
- public:
- double r, a;
- Polar()
- {
- r = 0;
- a = 0;
- }
- Polar(double rad, double angle)
- {
- r = rad;
- a = angle;
- }
- void change_r()
- {
- cout << "Enter new radius: " << endl;
- cin >> r;
- }
- void change_a()
- {
- cout << "Enter new angle: " << endl;
- cin >> a;
- }
- void rad_to_deg()
- {
- a *= 180 / pi;
- }
- void dec()
- {
- cout << "x: " << r*cos(a)<<endl;
- cout << "y: " << r*sin(a) << endl;
- }
- };
- void dist(Polar A, Polar B)
- {
- cout << sqrt(A.r*A.r + B.r*B.r - 2 * A.r*B.r*cos(max(A.a, B.a) - min(A.a, B.a))) << endl;
- }
- void check(Polar A, Polar B)
- {
- if (A.a == B.a && A.r == B.r)
- {
- cout << "Coincidence" << endl;
- }
- else {
- cout << "Non-coincidence" << endl;
- }
- }
- int main()
- {
- Polar A, B(1,2);
- A.change_a();
- A.change_r();
- A.dec();
- dist(A, B);
- check(A, B);
- A.rad_to_deg();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement