So, I went on to how I can use an integer type to enter input, and looked at char ... since it is technically the smallest integer type, it can be used to get the code ... I was able to come up with this, but it definitely not yet specified (and I'm not sure what it might be):
int main() {
int count=0;
while(!(count==4)){
char digit;
cin.get(digit);
count++;
}
return 0;
}
So, the cycle continues until 4 characters are collected. Well, theoretically it should be. But that will not work. It will stop at 2 digits, 5 digits, etc. I think it could be the character cin.get () capturing a space, not sure.
source
share