Format Specifiers: Format_Character
This lesson explains the format_character, which is a part of formatted output.
We'll cover the following...
format_character #
The following format characters are used in the wrtiefln() function:
-
b: an integer argument is displayed in the binary system. -
o: an integer argument is displayed in the octal system. -
xandX: an integer argument is displayed in the hexadecimal system; with lowercase letters when usingxand with uppercase letters when usingX. -
d: an integer argument is displayed in the decimal system; a negative sign is also displayed if it is a signed type and the value is less than zero.
D
import std.stdio;void main(){int value = 12;writefln("Binary : %b", value);writefln("Octal : %o", value);writefln("Hexadecimal: %x", value);writefln("Decimal : %d", value);}
-
e: a floating point argument is ...
Ask