Академический Документы
Профессиональный Документы
Культура Документы
Variables
In an
Flag Meaning What It Prints
Example
an integer that takes 6 spaces and starts in
- "%-6d" Align left
the first one
In an
Flag Meaning What It Prints
Example
0 "%07.2f" Show leading zeroes 0001.23
Show a plus sign for positive
+ "%+7.2f" +1.23
numbers
Enclose negative numbers in
( "%(6.2f" -1.23 would look like (1.23)
parentheses
, "%,10d" Show decimal separators 12,300
^ "%^s" convert letters to uppercase "tax:" would print as "TAX:"
Strings
Counting Matches
matches = 0
matches = matches + 1
position = 0
else
position = position + 1
Maximum
largest = the first item