Vector2 position(5.0, 7.0); float posY = position.getY(); std::cout << "Y position: " << posY << std::endl;
std::vectorThis example creates a vector of three Vector2 objects, loops through them and retrieves the Y-component of each vector using the getY method, and finds the maximum Y value. It outputs the result to the console. The Vector2 class is not a part of the standard C++ library, so it is likely that it belongs to a third-party library or a custom one developed for this project.points = {{0.5, 1.0}, {2.0, 3.5}, {6.3, 4.1}}; float maxY = 0.0; for (auto& p : points) { if (p.getY() > maxY) { maxY = p.getY(); } } std::cout << "Max Y value: " << maxY << std::endl;