Consider this snippet:
int a;
while (cin >> a){/* do something */}
On running this code, suppose I enter a string. The loop is exited. But then, since the expression inside while
ends in error, and it doesn't evaluate to a bool
type (is this incorrect thinking?), how does the compiler know to exit the loop?
Aucun commentaire:
Enregistrer un commentaire