Hello all. I need some help on some code...

function definition

double Magnitude () const;

function implementation

double Vector::Magnitude () const

{return sqrt(X*X + Y*Y + Z*Z);}

Test

cout<<"test 4 \n";
cout<<"VectorA ^ VectorB = " (VectorA^VectorB)<<" = "<<(VectorA^VectorB).Magnitude()<<endl;

I get c2064 on the portion of code highlighted in red. The theme of the lab is operator overloading. Let me know if this sufficient for a diagnosis. Thanks a bunch

Recommended Answers

All 2 Replies

From this code without using code tags for C++, I can't see the presence of spaces. Is (VectorA^VectorB) a Vector variable? It can be a quote (") problem. Make sure that there are spaces at each side of the << .

You are missing a quote (in red): cout<<"VectorA ^ VectorB = " (VectorA^VectorB)"<<" = "<<(VectorA^VectorB).Magnitude()<<endl;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.