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";
This is a discussion on Arithmetic Help within the C++ Programming forums, part of the General Programming Boards category; Hey, how do I assign a math problem to a variable? Example: x + y > answer (variable) I want ...
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 answerx + y > answer (variable)
would give you the output: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.