Slide11 - 2
Slide11 - 2
C Formatted Input/Output
C How to Program, 7/e
Binary 2 01
Octal 8 01234567
Decimal 10 0123456789
Hexadecimal 16 0123456789ABCDEF
9.4 Printing Integers (Cont.)
• The scan set can also be used to scan for characters not
contained in the scan set by using an inverted scan set.
• To create an inverted scan set, place a caret (^) in the
square brackets before the scan characters.
• This causes characters not appearing in the scan set to
be stored.
• When a character contained in the inverted scan set is
encountered, input terminates.
• Figure 9.22 uses the inverted scan set [^aeiou] to
search for consonants—more properly to search for
“nonvowels.”
© 2016 Pearson Education, Ltd. All rights reserved.
© 2016 Pearson Education, Ltd. All rights reserved.
9.11 Reading Formatted Input with scanf (Cont.)