Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <complex>
- using namespace std;
- typedef complex<double> vect;
- double dot(vect &a, vect &b)
- {
- return real(conj(a)*b);
- }
- int main()
- {
- double a1,a2,b1,b2;
- cin >> a1 >> a2 >> b1 >> b2;
- vect a(a1,a2), b(b1,b2);
- //cout << dot(a,b) << '\n';
- double ang = acos( dot(a,b) / (sqrt(real(a)*real(a)+imag(a)*imag(a))*sqrt(real(b)*real(b)+imag(b)*imag(b))) );
- cout.precision(5);
- cout << fixed << ang << '\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement