So I'm trying to find angles A,B,C using law of cosines and I want the answers to be in degrees and the formula to convert the answer to degrees is angle*PI/180. However the answer does not convert to degrees what am I doing wrong?
Code:#include "stdafx.h" #include <iostream> #include <iomanip> #include <cmath> #define PI 3.14 using namespace std; int main() { double A,B,C,a,b,c,b1,b2,h,R,L,T,x; //This is for angle a a = 10.0; b = 7.0; c = 5.0; A = (b*b+c*c-a*a)/(2.0*b*c); A = acos(A)*PI/180.0; cout <<"\n\n\t\tThe value of angle A ="<<A; //This is for angle b a = 11.6; b = 15.2; c = 7.4; B = (a*a+c*c-b*b)/(2.0*a*c); B = acos(B)*PI/180.0; cout<<"\n\n\t\tThe value of angle B ="<<B; //This is for angle c a = 2.0; b = 3.0; c = 4.0; C = (a*a+b*b-c*c)/(2.0*a*b); C = acos(C)*PI/180.0; cout<<"\n\n\t\tThe value of angle C ="<<C; cout<<"\n\n\n\n"; return 0; }



LinkBack URL
About LinkBacks


