14274 - Geometry   

Description

In this problem, you are asked to implement a class Vector that represents a vector in 2D space. The class should support the following operations:

  • Addition (+)
  • Dot product (*)
  • Cross product (^)

Using these operations, you should also be able to calculate the following:

  • The area of the triangle formed by two vectors
  • The projection of vector \(v_1\) onto vector \(v_2\)

useful link

Warning: You should use C++11 or later versions, or else you will get Compile Error! reason

Input

The first line contains two integers \(x_1, y_1\), which represents the first vector \(v_1\).
The second line contains two integers \(x_2, y_2\), which represents the second vector \(v_2\).

\(x_1 \quad y_1\)
\(x_2 \quad y_2\)

Constraints

  • \(1 \le x_1,y_1,x_2,y_2 \le 1000\)

Output

As main function in "14274.cpp"

Sample Input  Download

Sample Output  Download

Partial Judge Code

14274.cpp

Partial Judge Header

14274.h

Tags




Discuss