# Arithmetic Help

• 03-18-2009
cduce2411
Arithmetic Help
Hey, how do I assign a math problem to a variable? Example:

x + y > answer (variable)

I want to do something of that formula, instead of:

cout << "x + y";
• 03-18-2009
BuzzBuzz
To assign something the equation goes to the right:

variable = x + y

However, you've got two completely different things going on in your question:

Quote:

x + y > answer (variable)
would mean that x + y is greater than answer

Quote:

cout << "x + y";
would give you the output:

Code:

`x + y`
• 03-18-2009
stanlvw
I don't know what you mean by assigning a math problem to a variable. You can assign an expression to a variable, for example:

answer = x + y;

If you want to display the expression "x + y", you assign "x + y" to a string variable. I'm not sure if I've missed your question.
• 03-18-2009
cduce2411
Quote:

Originally Posted by BuzzBuzz
To assign something the equation goes to the right:

variable = x + y

However, you've got two completely different things going on in your question:

would mean that x + y is greater than answer

would give you the output:

Code:

`x + y`

Thanks, I got it now. I used > more as an arrow to go into the variable, but I understood how it could be mixed up. Thanks again.