Q:

What causes the following while to terminate

0

What causes the following while to terminate?

while (cin >> i) /* ... */

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

The condition of a stream is equivalent to `!fail()`, which means set either `failbit` or `badbit` will terminate the loop. For example, errors list below will terminate the loop:

- System-level failure. (Set the `badbit`) Such as an unrecoverable r/w error.

- Recoverable error. (Set the `failbit`) Such as reading a character when numeric data expected.

- Reaching end-of-file. (Set both the `eofbit` and `failbit`)

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now