#includeThis code defines a Vector3 class with x, y, and z coordinates, as well as a Mag function that calculates the magnitude of the vector. In the main function, a vector of three Vector3 objects is created and the Magnitude of each vector is printed to the console. The package library being used in this example is the C++ standard library.#include #include class Vector3 { public: double x, y, z; Vector3(double x_, double y_, double z_) : x(x_), y(y_), z(z_) {} double Mag() const { return std::sqrt(x*x + y*y + z*z); } }; int main() { std::vector v { Vector3(1, 2, 3), Vector3(-3, 4, 1), Vector3(0, -5, 2), }; for (auto& p : v) { std::cout << "Vector: (" << p.x << ", " << p.y << ", " << p.z << ")" << std::endl; std::cout << "Magnitude: " << p.Mag() << std::endl; } return 0; }