This is a discussion on figuring out size of numbers within the C++ Programming forums, part of the General Programming Boards category; stringstream...
I've used atoi() in my code already, so I will use itoa() to go the other way. and the format function won't help. The variable has to be a const char* to be used in one of the functions, so I have to convert it. Casting it gives a run-time read error.
Everything is relative...
Maybe I'm missing something, but why don't you just read the user's input as an integer?
Code:cout << "Enter a four digit number immediately: "; int entry; (cin >> entry).get(); if (!is_four_digits(entry)) cout << "Yo stupid, I said enter a fo' digit numbah son!" << endl;