> Can anyone fix this on visual studio c++?

Can anyone fix this on visual studio c++?

Posted at: 2014-12-18 
Yes

you forgot the closing }

and if you have a bad operator Result is undefined yet you still try to print it....

#include

int main()

{

double Operand1, Operand2, Result;

char Operator;

cout << "This program allows you to perform an operation on two numbers\n";

cout << "To proceed, enter a number, an operator, and a number:\n";

cin >> Operand1 >> Operator >> Operand2;

switch(Operator)

{

case '+':

Result = Operand1 + Operand2;

break;

case '-':

Result = Operand1 - Operand2;

break;

case '*':

Result = Operand1 * Operand2;

break;

case '/':

Result = Operand1 / Operand2;

break;



default:

cout << "Bad Operation";

}

cout << "\n" << Operand1 << " " << Operator << " "

<< Operand2 << " = " << Result;

cout << "\n\n";

return 0;