using namespace std;
cout << "Enter a Number";
cin >> dX;
cout << "Enter another Number";
cin >> dY;
cout << "Enter a Symbol";
cin >> symbol;
if (symbol == '+');
cout << dX << " + " << dY << " Is " << dX + dY << endl;
if ('-' == symbol);
cout << dX << " - " << dY << " Is " << dX - dY << endl;
if (symbol == '*');
cout << dX << " * " << dY << " Is " << dX * dY << endl;
if (symbol == '/');
cout << dX << " / " << dY << " Is " << dX / dY << endl;
return 0 ;
Pretty new to C++ and I'm learning off the tuts at learn C++. Anyways, i was doing the comprehensive quiz,(I'm using visual studio express 2k12) and I finished the task quite simply. The program runs but displays all of the math and not the math that was requested.
For example, I can input any two numbers within the double and then input a symbol; the program then shows all of the math of the two numbers, (x+y, x*y, x-y, x/y).
How do I get it to show me only the symbol that is imputed.