The reason for the incorrect result is the other variables were not initialised and so had whatever random value happened to be in that memory location.
Apart from the previous comment I think that you was going to enter digits not some numbers. In this case it would be better to use an object of type char to store an entered digit. Something as for example
1 2 3 4 5 6
char c;
do
{
std::cin >> digit;
} while ( isdigit( c ) );