#include <iostream> #include <cmath> struct Vector { double x, y, z; }; double dotProduct(const Vector& v1, const Vector& v2) { return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z; } double magnitude(const Vector& v) { return sqrt(v.x * v.x + v.y * v.y + v.z * v.z); } double angleBetweenVectors(const Vector& v1, const Vector& v2) { double dot = dotProduct(v1, v2); double mag1 = magnitude(v1); double mag2 = magnitude(v2); return acos(dot / (mag1 * mag2)); } int main() { Vector v1 = {1.0, 0.0, 0.0}; Vector v2 = {0.0, 1.0, 0.0}; double angle = angleBetweenVectors(v1, v2); std::cout << "Angle between vectors = " << angle * 180.0 / M_PI << " degrees" << std::endl; return 0; }