Jon Jon - 5 months ago 34
C++ Question

How to store separately inputted numbers in same variable C++?

How can I store two separately inputted numbers into one variable that stores the first number in the tens place, and then the second number in the ones place? For example...

int num1 = 0;
int num2 = 0;
cout<<"first number: ";
cout<<"second number: ";
//now the variable both should store the number 12
int both = ?????????;

int result = num1 * 10 + num2;