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
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";
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 answerQuote:
x + y > answer (variable)
would give you the output:Quote:
cout << "x + y";
Code:x + y
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.