Task

Express a number in decimal as a fixed-length string with leading zeros.



For example, the number   7.125   could be expressed as   00007.125.




int C;
[Format(5, 3);                  \5 places before decimal point and 3 after
RlOut(8, 7.125);                \output real number to internal buffer
loop    [C:= ChIn(8);           \read character from internal buffer
        if C = ^  then C:= ^0;  \change leading space characters to zeros
        if C = $1A then quit;   \exit loop on end-of-file (EOF = end of chars)
        ChOut(0, C);            \display digit character on terminal
        ];
]