Bonjour|x|Bonsoir,
Je voudrais utiliser Get_float mais celui-ci a plusieurs déclaration dans le package ada.text_io.float_io que voici (Sans file management):
Je ne sais pas laquelle et comment l'utiliser , j'ai utilisé la 1ere avec le code suivant qui comprends 3 fichier (le main file , mon paquet body créer .adb et mon paquet créer .
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 procedure Get (Item : out Num; Width : Field := 0); procedure Get (From : String; Item : out Num; Last : out Positive);
ads):
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 with Ada.Text_IO; with Identification; -- File : log_in.adb Procedure log_in is Password : Identification.Password_Value; virgules : Identification.virgules_Value ; begin Identification.Get (Password => Password); if Password = "admin" then Ada.Text_IO.Put_Line (Item => "Welcome, Administrator."); end if; if virgules'Valid then Ada.Text_IO.Put_Line("A float number was not asked") ; end if; end log_in;
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 with Ada.Text_IO; with Ada.float_text_IO; -- File : identification.adb package body identification is procedure Get_float (Item : out virgules_Value; Width : Field := 0) is begin Ada.float_text_IO.get(Item => virgules); Ada.Text_IO.Skip_Line; end Get_float; procedure Get (Password : out Password_Value ) is begin Ada.Text_IO.Put (Item => "Hello, User. What's your name? "); Get_Name : declare Name : String := Ada.Text_IO.Get_Line; begin if Name /= "codezero1" then Ada.Text_IO.Put_Line (Item => "You're not Administrator."); Get_float ; else Ada.Text_IO.Get (Item => Password); Ada.Text_IO.Skip_Line; Ada.Text_IO.New_Line; end if; end Get_Name; end Get; end identification;
Les erreurs du compilateur sont :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 -- File : identification.ads package identification is subtype Password_Value is String (1..5); subtype virgules_Value is Float ; procedure Get (Password : out Password_Value); procedure Get_float (Item : out virgules_Value; Width : Field := 0); -- errors: "Field" is not visible ,and, non-visible declaration at a-textio.ads:74 end identification;
identification.ads:13:15: "Field" is not visible
identification.ads:13:15: non-visible declaration at a-textio.ads:74
Partager