par_tocontrol_float_values.adb
来自「This contains the following topics and m」· ADB 代码 · 共 28 行
ADB
28 行
-- A floating point number is output using the overloaded procedure Put, though
-- by default this displays the number in scientific notation. Extra parameters
-- to Put are used to control the output form of the floating point number.
-- These parameters are used together or individually. The main parameters to
-- control the format are named Fore,Aft and Exp. For example, to output the
-- contents of the Float object Num that contains 123.456 the following
--versions of Put may be used:
-- A floating point number is output using the overloaded procedure Get
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
procedure par_tocontrol_float_values is
number : Float := 23.45E+02;
value : Float;
begin
Get (value, Width => 4);
Put (value);
New_Line;
Put (number);
New_Line;
Put (number, Fore => 3, Aft => 1, Exp => 0);
New_Line;
Put (number, Fore => 2, Aft => 2, Exp => 1);
New_Line;
end par_tocontrol_float_values;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?