Class Vector - operations on vectors
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Create a class named **Vector** that represents a vector on a plane with two coordinates: **x** and **y**. Implement three constructors for this class: - A default constructor that initializes the class fields to zero. - A constructor that accepts two integer parameters, representing the vector's coordinates. Implement the following methods: - `void Input()`: This method reads two vector coordinates, x and y, from a single line of input, separated by a space. - `void Out()`: This method outputs the vector coordinates, separated by a space, followed by a newline. Overload the following operators: - `=` (assignment), - `+` (vector addition), - `-` (vector subtraction), - `+=` and `-=`, - `*` (vector multiplication, representing the scalar product of vectors, which returns a number). Submit only the class implementation. The solution will be evaluated for the programming languages C++ and C#.
Submissions 675
Acceptance rate 29%