Что нужно написать чтобы вывести v3 на экран #include using namespace std; struct vector3 { int x, y, z; vector3() {} vector3(int x, int y, int z): x(x), y(y), z(z) {} vector3 operator + (vector3 v1) { return vector3(this-> x+v1.x,this-> y+v1.y,this-> z+v1.z); } }; int main() { vector3 v1(1, 2, 3); vector3 v2(4, 5 ,6); vector3 v3; v3 = v1 + v2; }
#include <sstream>
using namespace std;
struct Vector3
{
int x, y, z;
Vector3()
{}
Vector3(int x, int y, int z): x(x), y(y), z(z)
{}
Vector3 operator + (Vector3 v1)
{
return Vector3(this->x+v1.x,this->y+v1.y,this->z+v1.z);
}
std::string ToString()
{
std::stringstream s;
s <<"(" << this->x << "," << this->y <<"," << this->z << ")";
return s.str();
}
};
int main()
{
Vector3 v1(1, 2, 3);
Vector3 v2(4, 5 ,6);
Vector3 v3;
v3 = v1 + v2;
cout << v3.ToString();
}