[cs13001] there were some offline questions on the usefulness of conditional assignment

Mikhail Nesterenko mikhail at cs.kent.edu
Thu Sep 12 11:32:52 EDT 2013


CSI students,

Note that the second part of the looping (third) lab can be done with
the conditional assignment. Specifically, on the basis of the values
if the loop variables, you can decide to output either a star or a
space. For example,


       char outChar = boolean expression on looping vars ?  '*' : ' ';
       cout << outChar;

Or, even shorter:

       cout <<  boolean expression on looping vars ? '*' : ' ';


Thanks,
-- 
Mikhail


More information about the cs13001 mailing list