#include#include int main() { double angle = 1.2; // radians double cosine = std::cos(angle); std::cout << "Cosine of " << angle << ": " << cosine << std::endl; return 0; }
#include#include int main() { double angle = 0.35; double hypotenuse = 5.2; double opposite = std::sin(angle) * hypotenuse; double adjacent = std::cos(angle) * hypotenuse; std::cout << "Opposite: " << opposite << std::endl; std::cout << "Adjacent: " << adjacent << std::endl; return 0; }
Opposite: 1.83427 Adjacent: 5.05606The std::cos function is part of the C++ standard library