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";

Printable View

- 03-18-2009cduce2411Arithmetic 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-2009BuzzBuzz
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)

Quote:

cout << "x + y";

Code:`x + y`

- 03-18-2009stanlvw
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-2009cduce2411