Convert Radians to Degrees using C++

Calculate by formula

#include <iostream>
#include <cmath>

double radiansToDegrees(double radians)
{
    return radians * 180 / M_PI;
}

int main()
{
    double radians = 3.14159;
    double degrees = radiansToDegrees(radians);

    std::cout << degrees << std::endl;

    return 0;
}

Leave a Comment

Cancel reply

Your email address will not be published.