this is a C++ question, but i hope to find some help here.Code:while (cin >> x) { ++count; sum += x ; }
i'm reading "accelerated C++" book and they have this example to demo that cin can be used to count previously entered values.
why cin holds all the previously entered values? would not it be a risk? if i have some system sending high frequency signals to CIN and then i'd count their number.... Sounds dangerous to me...
what am i not understanding here?
Thank you