[cs23021-2] on entering cents and dollars in Strings/IO lab

Mikhail Nesterenko mikhail at cs.kent.edu
Sat Mar 6 18:14:51 EST 2010


CSI students,

The check amount (for dollars and for cents) can be entered as either
integer or as two characters -- one for each digits as it was done in
the branching lab.

If you are entering the check amount as integer, the digits for
specific decimal places have to be extracted from the number. Integer
division and reminder are useful for that.

For example, the below code extracts the digit for tens.

      int myNumber;
      cin >> myNumber;
      int tens = (myNumber % 100) / 10; 
    
Thanks,
--
Mikhail



More information about the cs23021-2 mailing list