Hi. I am making a calculator, and I manage to add two numbers with two lines and two different inputs. I am now trying to make it avaliable to input two numbers on the same line. Like one input for two numbers who will add. Is there a way to do this? And while I am on it, how can I make it avaliable to input an operator like "+", "-", "/" and "*"?
Here is my code:
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
usingnamespace std;
int result, num1, num2;
int main()
{
cout << "Plase enter the numbers you want to add: ";
cin >> num1;
cin >> num2;
result = num1+num2;
cout << "The result is: " << result << endl;
}
Here I have two "cin's" and I want to make it one, if you get it. Is there a way to do that? :)