求两个向量的内积

更新时间:02-04 教程 由 念旧 分享

求两个向量的内积?

#include

using namespace std;

class V

{

double x,y;

public:

V(){}

V(double a,double b)

{

x=a;

y=b;

}

friend V operator*(V a,V b)

{

V c;

c.x=a.x*b.x;

c.y=a.y*b.y;

return c;

}

void show()

{cout<

};

int main()

{

V v1(1,3),v2(2,5),c3;

V *p1,*p2;

p1=&v1;

p2=&v2;

c3=(*p1)*(*p2);

c3.show();

return 0;

}

声明:关于《求两个向量的内积》以上内容仅供参考,若您的权利被侵害,请联系13825271@qq.com
本文网址:http://www.25820.com/tutorial/14_2179686.html