I have several errors in this program. I'm having trouble using static_cast.
Can someone please help me use static_cast in this program. I'm completely clueless.
Here is my program:
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
usingnamespace std;
int main()
{
double Op1, Op2, result;
char Operator;
cout << "This program is used to calculate numerical expressions." << endl;
cout << "If you wish to continue, please enter a number, an operator, and another number " << endl;
cin >> Op1 >> Operator >> Op2;
if (Operator == '+')
result = Op1+Op2;
elseif (Operator == '-')
result = Op1-Op2;
elseif (Operator == '*')
result = Op1*Op2;
elseif (Operator == '/')
result = Op1/Op2;
int Operator = static_cast<int>(Op1);
elseif (Operator == "div")
result = Op1/Op2;
int Operator = static_cast<int>(Op1);
elseif (Operator == "mod")
result = fmod(Op1,Op2);
elseif (Operator == '^')
result = pow(Op1,Op2);
elseif (Operator == '%')
result = (Op1/Op2)*100;
cout << "The answer is " << result << endl;
system("pause>nul");
return 0;