Up: Return
Notes
- Writing If-Statements
- ``Think positive'' while writing if
statements. If you find yourself thinking in terms of: ``If this and
this is the case I need to skip ...'', then you are going
wrong. You should immediately correct this thinking
to ``If this and this is not the case, I need to do ...''.
Similarly, ``If this and this is the not case I need to skip ...'',
then you are going wrong. You should immediately correct this
thinking to ``If this and this is the case, I need to do ...''.
For example, ``If the applicant is international, skip asking for
a social security number'' should be programmed something like:
if (us_citizen) {cout << "Soc-sec-no: ``; cin >> soc_sec;}
Author: Leon van Dommelen