help with int

while (number <= 0 || number > 16000000000){
cout << "Please the size of memory: ";
cin >> number;
}

Why does this only accept numbers upto 1600000000 with only eight zeros and not 16000000000? how to fix this?
try, long long int number;
Integer values are constrained by the number of bits they have to store numbers.

Your computer's int is a 32-bit type, which, subtracting one bit for the sign of the number, lets your integers have a maximum value of 2**31-1, or 2,147,483,647, which is less than 16,000,000,000.

You can try a long long int, which should give you a 63-bit (+1 bit for the sign) value.

Good luck!
Topic archived. No new replies allowed.