I am working on an assignment for school that prints a table with the values for cosine and sin up to 360 degrees, as well as the degrees and radians in various step sizes.
Problem is that the values are wrong. The Radians keep starting at 1 and not 0.
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
Also, don't use doubles in a for loop - their representation is not exact. Instead work out how many times to loop as an integer and use that in the for loop.
M_PI / 180.0 is a constant value, so make it so:
constexpr double DegToRadians = M_PI / 180.0;
Edit: When dealing with doubles, I like to always put digits before and after the decimal point, as in 180.0 or 0.3 not 180 or .3. It just reinforces the idea that it is a double. And it can promote results of expressions to double.