I think you'd be best off using the get function. It returns a signed integer, and on an x86 CPU this means a range of -2,147,483,648 to +2,147,483,647 for each digit.
So what you would do, is have a loop. In the loop you use std::cin.get() to take an integral number and place it in the current position of an array or string. Then you, depending on whether you used an array of integers (a) or a string (b),
a. convert the array into a single integer
b. use a stringstream, which is easier by far.
1458 IS one digit represented by four integers |
Wait, what? No it isn't! It's one integer represented by four digits! It's one-thousand, four-hundred and fifty-eight; not 1, 4, 5 and 8 conveniently placed closely together!
Edit: what OP wants is to get the single integer 1458 and
then read it as four separate integers (actually, 1458 has no relevance to the topic at all and is being used as an example).