Mar 12, 2019 at 4:12pm
You want to type "13" and set a=1 and b=3?
Mar 12, 2019 at 4:21pm
no no,
if someone types 1 and after the space an other number it takes the number after the space as the next input and i want to prevent that.
Mar 12, 2019 at 4:33pm
Add #include <limits>
with your other include(s).
After std::cin >> a;
add:
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
That will extract and discard any remaining characters in std::cin's buffer.
Mar 12, 2019 at 6:28pm
Oh, so
1 3
2
should result in a=1 and b=2.