
please wait
|
|
57.2957795
earlier. You should make this a const double
variable and refer to it in your code rather than use magic numbers like you have.goto
. Don't do it - it is really bad style. Investigate using functions and loops instead. I am not saying goto
should be banned - there are situations where experts have a need to use them, but until you are an expert avoid using them at all costs.double
rather than float
. The trig functions expect values that are double, and will convert them to double if they are not, and they return double as well. If you assign an answer to a float, you should get a loss of precision warning from the compiler. Make sure the warning level is set to it's highest, with g++, use -Wall -Wextra -pedantic
Trig_count
and End
should be unsigned int
Trig_Count = Trig_Count + 1;
Trig_Count++;
Trig_Count = Trig_Count + 500;
Trig_Count += 500;
Trig_Count
the way you have, investigate using a switch
statement instead. Each case
can call the appropriate function. Put the whole thing in a while
loop, call the function that displays the menu at the start of the loop, and have a default
case to catch bad input. This will be a much cleaner overall solution.atan
function - it returns angles less than 90 degrees, so this is a problem if you were expecting an answer in a different quadrant. Use atan2
, which takes 2 arguments (x,y).