Bonjour à tous ,
Je suis débutant en programmation ada, je suis en auto-formation , je viens d'écrire un programme qui lit un entier et dit cet entier est premier ou pas?
Seulement à la compilation j'obtiens que vous trouverez plus bas .
Merci de bien vouloir m'aidez , car j'ai parcouru le passage types du manuel de Barnes (ADA 95 ) .Mais ça n'a pas marché.
Merci d'avance.
Voici le programme en question.
A la compilation j'obtiens.
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
39
40
41
42
43
44
45
46
47 ---------------------------------------------------------------------- with ada.text_io , ada.Integer_text_io , Ada.Numerics.Elementary_Functions ; use ada.text_io , ada.Integer_text_io , Ada.Numerics.Elementary_Functions ; PROCEDURE N_premier IS n ,d: Integer ; BEGIN WHILE ( n < 3 ) LOOP put("Saisissez un entier au moins 3." ) ; get (n) ; END LOOP; d:= 2 ; WHILE (n MOD d AND d <= sqrt(n) ) LOOP d:=d+1 ; END LOOP ; IF (n MOD d) THEN put( n ) ; put("n'est pas premier.") ; ELSE put( n ) ; put("est premier.") ; END IF ; END N_premier; ----------------------------------------------------------------------
gnatmake N_premier.adb
gcc -c N_premier.adb
N_premier.adb:15:12: warning: file name does not match unit name, should be "n_premier.adb"
N_premier.adb:32:26: expected type "Standard.Boolean"
N_premier.adb:32:26: found type "Standard.Integer"
N_premier.adb:32:48: expected type "Standard.Float"
N_premier.adb:32:48: found type "Standard.Integer"
N_premier.adb:40:30: expected a boolean type
N_premier.adb:40:30: found type "Standard.Integer"
gnatmake: "N_premier.adb" compilation error
Partager