Mat...I tried this,but it returns wrong values -:
I try any angle,'cos' always comes 1,and the rest the same garbage.Code:void Program::Trigonometry() { double pi = 3.1416; //Again for trigo. if (g[0] == 'M' || 'm') { setcolor(7); cout << "Enter angle theta (degrees) -"; cin >> degrees; a == degrees * (pi/180); Sine = sin (a * (180/pi)); Cosine = cos (a * (180/pi)) ; Tangent = tan (a * (180/pi)); Arctan = atan (a * (180/pi)); Arccos = acos (a * (180/pi)); Arcsine = asin (a * (180/pi)); } else if (g[0] == 'N' || 'n') { setcolor(7); cout << "Enter angle theta(radians) -"; cin >> radians; cin.ignore(); a == radians; Sine = sin (a); Cosine = cos (a); Tangent = tan (a); Arctan = atan (a); Arccos = acos (a); Arcsine = asin (a); } cout << "\nThe trigonometric ratios are as follows -:\n"; setcolor(14); cout << "Sin theta = " << Sine << endl; cout << "Cos theta = " << Cosine << endl; cout << "Tan theta = " << Tangent << endl; cout << "Inverse Sin(Arcsine) theta = " << Arcsine << endl; cout << "Inverse Cos(Arccos) theta = " << Arccos << endl; cout << "Inverse Tan(Arctan) theta = " << Arctan << endl; }



LinkBack URL
About LinkBacks



