Well..I changed the stuff and added a separate Radians Degrees Conversion part instead
Code:
void Program::Case6()
{
cout << "This is the radians-degrees/degrees-radians converter\n";
cout << "Choose - (M)Radians -> Degrees, (N)Degrees -> Radians\n";
cin >> g;
cin.ignore();
setcolor(13);
if (g[0] == 'M' ||g[0] == 'm')
{
cout << "Enter radians - ";
cin >> radians;
degrees = radians * (180.0 / M_PI);
cout << "Radians -> Degrees says " << degrees << " degrees" << endl;
}
else if (g[0] == 'N' ||g[0] == 'n')
{
cout << "Enter degrees - ";
cin >> degrees;
radians = degrees * (M_PI / 180.0);
cout << "Degrees -> Radians says " << radians << " radians" << endl;
}
setcolor(7);
}
But now I have problems with the program termination and case 7(trigonometry)
This is the program restart or quit code
Code:
void Program::RorQ() //Gives user the option to restart or quit
{
C.exitRorQ = 1;
while(C.exitRorQ == 1)
{
clrscr();
cout << "(r) restart or (q) quit" <<endl;
cout << ">";
cin >> C.rq[1];
if (C.rq[1] == 'r')
C.exitRorQ = 0;
else if (C.rq[1] == 'q')
{
C.exitRorQ = 0;
EXIT();
}
else
{
cout << "Thats not a choice... Please rechoose" << endl;
}
}
}
And this is the Case7
Code:
void Program::Case7()
{
setcolor(12);
cout << "Enter angle theta (radians) - ";
cin >> radians;
a = radians;
Sine = sin (a);
Cosine = cos (a);
Tangent = tan (a);
Arctan = atan (a);
Arccos = acos (a);
Arcsine = asin (a);
cout << "\nSine theta is " << Sine;
cout << "\nCos theta is " << Cosine;
cout << "\nTangent theta is " << Tangent;
cout << "\nInverse Sine(Arcsine) theta is " << Arcsine;
cout << "\nInverse Cos(Arccos) theta is " << Arccos;
cout << "\nInverse Tan(Arctan) theta is " << Arctan;
cout << "\n";
setcolor(7);
Sleep(3000);
}
.....
.....
case 7:
OMGDOIT.Case7();
OMGDOIT.TerminationPrevention();
OMGDOIT.RorQ();
break;
The restart or quit option works on all cases BUT this..If I try twice both r and q quit the program...