0

I decided to just try and make a program that would identify what KIND of expression you entered, not even evaluate it. Just for it to say: “You entered an addition equation. ” when you enter an equation with a value, a plus sign, then another value … and so on for other types of equations. The problem is that no matter what type of equation I enter, whether it is 5 + 5, 5 – 5, 5 * 5, or 5 / 5 I always get a response telling me that I entered a subtraction equation. Any ideas, anyone?

```
#include <iostream>
using namespace std;
long int x;
long int y;
long int z;
bool expression;
int main()
{
cout << "Enter an expression to be evaluated: " << endl;
cin >> expression;
if(expression == true + true) /* i.e. if any integer other than zero is
entered, followed by a plus sign, then another integer other than zero */
{
cout << "You entered an addition equation. " << endl;
}
if(expression == true/true) /* i.e. if any integer other than zero is
entered, followed by a division sign, then another integer other than zero */
{
cout << "You entered a division equation. " << endl;
}
if(expression == true-true) // like above, but with subtraction
{
cout << "You entered a subtraction equation. " << endl;
}
if(expression == true*true) // and again like above, with multiplication
{
cout << "You entered a multiplication equation. " << endl;
}
cin.clear();
cin.ignore(255, '\n');
cin.get();
// ^^ is for Dev C++ so the program stays open until I prompt it to exit
return 0;
}
```