#include <iostream>
using namespace std;
class vector2d{
public:
int x1,x2;
void dodaj(vector2d);
void wyswietl(vector2d);
void odejmij(vector2d);
void wyswietl1(vector2d);
};
void vector2d:: wyswietl(vector2d x){
x1=x.x1;
x2=x.x2;
};
void vector2d:: wyswietl1(vector2d y){
x1=y.x1;
x2=y.x2;
};
void vector2d::dodaj(vector2d y){
x1=x1+y.x1;
x2=x2+y.x2;
};
int main() {
vector2d x,y;
x.x1= 3;
x.x2= 4;
y.x1= 1;
y.x2= 2;
x.wyswietl (x);
cout << x.x1<< " "<< x.x2<< endl;
x.wyswietl1 (y);
cout << x.x1<< " "<< x.x2<< endl;
x.dodaj( y);
cout << x.x1<< " "<< x.x2<< endl;
}
witam mam problem powyższy kod ma wyswietlać wspołrzedne wektora x oraz wektora y a natepnie dodac je. Jednak suma wychodzi nieprawidłowa a nie wiem gdzie znajduje sie bład. Byłabym wdzieczna za pomoc :)