I guess you'd have to write your own input function then. This is one I've made (uses conio.h):
Specify 0 as the parameter if you don't wish to have an upper limit. This might be useful too since it only accepts digits (not letters/other characters).
Code:
#include <iostream>
#include <conio.h>
using namespace std;
#define MAXDIGITS 9
int ReadNumber(int MaxNumber)
{
//Data
int i;
char Key = 0;
char Buffer[MAXDIGITS] = {'0'};
int CurrentPointer = 0;
int Result = 0;
//Loop until ENTER is pressed
while((Key != (char)13) || (CurrentPointer == 0))
{
//Get the next keypress
Key = getch();
//The user pressed a digit
if((Key >= '0') && (Key <= '9') && (CurrentPointer < (MAXDIGITS - 1)))
{
//Accept the input only if it doesn't exceed the limits
if((MaxNumber == 0) || (((Result * 10) + (int)(Key - '0')) <= MaxNumber))
{
Buffer[CurrentPointer] = Key;
CurrentPointer++;
cout << Key;
}
}
//The user pressed BACKSPACE
else if((Key == '\b') && (CurrentPointer > 0))
{
Buffer[CurrentPointer] = '0';
CurrentPointer--;
cout << '\b';
cout << ' ';
cout << '\b';
}
//Calculate the result
Result = 0;
for(i = 0; i <= (CurrentPointer - 1); i++)
{
Result *= 10;
Result += (int)(Buffer[i] - '0');
}
}
//Return the number
return Result;
}
//Test
int main()
{
int X;
cout << "Enter a number: ";
X = ReadNumber(500);
cout << endl << "Your input was: " << X << endl;
return 0;
}