Program Project2;{$APPTYPE CONSOLE}UsesSysUtils;Varnum: Integer;r1: Real;BeginRead(num, r1);Writeln(Format('%d 绝对值%%d:%d', [num, abs(num)]));Writeln(Format('%u 绝对值%%u:%u', [num, abs(num)]));Writeln(Format('%f 参数为浮点数,默认保留2位小数:%f', [r1, abs(r1)]));Writeln(Format('%e %%e为科学计数法:%e', [r1, abs(r1)]));Writeln(Format('%g %%g一般保留15位:%g', [r1, abs(r1)]));Writeln(Format('%m %%m money:%m', [r1, abs(r1)]));Writeln(Format('%2:s %1:s %0:s', ['1st', '2ab', '3cd']));Writeln(Format('%d',[12])); //最简单的形式Writeln(Format('%3d',[12]));//前面补空格Writeln(Format('%f',[12.0])); //以浮点数输出Writeln(Format('%f.3f',[12.0])); //指定小数位数Writeln(Format('动态小数位数%.*f',[5,12.0])); //以浮点数输出Writeln(Format('%.5d',[12]));Sleep(5000);
End.