Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct Vector {
- double x;
- double y;
- Vector ()
- {
- x = 0;
- y = 0;
- }
- Vector (double _x, double _y){
- x = _x;
- y = _y;
- }
- void printVector(){
- cout << x << " "<< y;
- }
- };
- Vector addVector(Vector v1, Vector v2)
- {
- // Them code cua ban o day
- Vector a;
- a.x = v1.x + v2.x;
- a.y = v1.y + v2.y;
- return a;
- }
- int main()
- {
- Vector v1, v2;
- cin>> v1.x>> v1.y>> v2.x>> v2.y;
- Vector a = addVector ( v1, v2);
- Vector ( a.x, a.y);
- a.printVector();
- return 0;
- }
Add Comment
Please, Sign In to add comment