Erreur de compilation, lvalue required as left operand
je travail sur un exercice en c++, quand je compile je trouve l'erreur suivante:
in function 'int coincide(vector3d, vector3d)':
error: lvalue required as left operand of assignement
mon code.h est :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| #ifndef VECTOR3D_H
#define VECTOR3D_H
class vector3d
{
float x,y,z;
public:
vector3d(float c1,float c2,float c3);
~vector3d();
friend int coincide(vector3d v1,vector3d v2);
private:
};
#endif // VECTOR3D_H |
mon code.cpp est comme suit:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| #include "vector3d.h"
#include <iostream>
using namespace std;
vector3d::vector3d(float c1=0,float c2=0,float c3=0)
{
x=c1;
y=c2;
z=c3;
}
vector3d::~vector3d()
{
//dtor
}
int coincide(vector3d v1,vector3d v2)
{
if(v1.x=v2.x && v1.y=v2.y && v1.z=v2.z)
return 1;
else
return 0;
} |
le main.cpp est comme suit:
Code:
1 2 3 4 5 6 7 8 9 10 11
| #include <iostream>
#include "vector3d.h"
using namespace std;
int main()
{
vector3d v1(1,3,6);
return 0;
} |