samedi 27 décembre 2014

“Programming Principles and Practice Using C++” Chapter 7.5 code error?

In the middle of page 230, under case '%', we see



double d = primary();


Near the bottom of the same page, we see



int i2 = narrow_cast<int>(term());


It seems to me that the second line is incorrect, and it should instead read



int i2 = narrow_cast<int>(primary());


if we want the remainder '%' to work from left to right, just like a division '/'. Am I missing something here?


Aucun commentaire:

Enregistrer un commentaire