fork download
  1. program ideone;
  2. uses SysUtils;
  3. const
  4. FloatFmt10:String = '0.##########';
  5. FloatFmt25:String = '0.#########################';
  6. FloatNum:String = '***'; //тут символи замість яких буде виводитись число
  7. function VarToString(format: string; const a: array of extended): string;
  8. var i, j: integer;
  9. s: string;
  10. x: extended;
  11. begin
  12. s:=format;
  13. for i := Low(a) to High(a) do
  14. begin
  15. j := Pos(FloatNum, s);
  16. Delete(s, j, Length(FloatNum));
  17. x := a[i];
  18. if x>1e18 then
  19. Insert(FloatToStrF(x, ffFixed, 50, 0), s, j)
  20. else
  21. if x<1e-10 then
  22. Insert(FormatFloat(FloatFmt25, x), s, j)
  23. else
  24. Insert(FormatFloat(FloatFmt10, x), s, j)
  25. end;
  26.  
  27. VarToString:=s;
  28. end;
  29.  
  30. begin
  31. (* your code goes here *)
  32. writeln(VarToString('***',2e23));
  33. writeln(VarToString('***',2e50));
  34. end.
Success #stdin #stdout 0s 4552KB
stdin
Standard input is empty
stdout
200000000000000000000000
200000000000000000007000000000000000000000000000000