A代码完善--向量的运算

# 注：本题只需要提交填写部分的代码，请按照C++方式提交。

#include <stdio.h>
#include <iostream>
using namespace std;
class Vector
{
private :
int x,y;
public:
void setValue(int x,int y)
{
this->x=x;
this->y=y;
}
void output()
{
cout<<"x="<<x<<",y="<<y<<endl;
}
Vector operator-();
friend Vector operator- (Vector &v1,Vector &v2);
};

int  main()
{
Vector A,B,C;
int x,y;
cin>>x>>y;
A.setValue(x,y);
cin>>x>>y;
B.setValue(x,y);
C = A - B;
C.output();
C = -C;
C.output();
return 0;
}
/*
请在该部分补充缺少的代码

*/

``10 20 15 25``

``````x=-5,y=-5
x=5,y=5``````

``````#include<stdio.h>
int main()
{
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
printf("x=%d,y=%d\nx=%d,y=%d\n",a-c,b-d,c-a,d-b);
return 0;
}``````

``````
#include <stdio.h>
#include <iostream>
using namespace std;
class Vector
{
private :
int x,y;
public:
void setValue(int x,int y)
{
this->x=x;
this->y=y;
}
void output()
{
cout<<"x="<<x<<",y="<<y<<endl;
}
Vector operator-();
friend Vector operator- (Vector &v1,Vector &v2);
};

int  main()
{
Vector A,B,C;
int x,y;
cin>>x>>y;
A.setValue(x,y);
cin>>x>>y;
B.setValue(x,y);
C = A - B;
C.output();
C = -C;
C.output();
return 0;
}
Vector Vector::operator-()
{
Vector v;
v.x=-x;
v.y=-y;
return v;
}
Vector operator- (Vector &v1,Vector &v2)
{
Vector v;
v.x=v1.x-v2.x;
v.y=v1.y-v2.y;
return v;
}
``````