voici un petit programme en ADA qui ne sert a rien mais bon c’est rigolo tout de meme 😀
D’autre programmes qui ne servent à rien par ici

 --*****************************************  --*Amusements temporels pour superstitieux*  --*                Version 0.9b           *
--* Babgond*
--*****************************************
with Simple_Io; use Simple_Io; procedure Vendredi13 is type Tmois is array (1 .. 12) of Integer; type Tnommois is (Janvier, Fevrier, Mars, Avril, Mai, Juin, Juillet, Aout, Septembre, Octobre, Novembre, Decembre); type Tnommoischaine is array (Tnommois) of String (1 .. 9); type Tnommoischaine2 is array (1 .. 12) of String (1 .. 9); Nommoischaine : Tnommoischaine; Tableumois : Tnommoischaine2 := (others => " "); Tabm : Tmois := (others => 0); Annee, Nb13, K : Integer := 0; Bon : Boolean := False; Continu : Character; J : Integer; procedure Init ( Nommoischaine : out Tnommoischaine ) is begin Nommoischaine(Janvier):="janvier "; Nommoischaine(Fevrier) :="fevrier "; Nommoischaine(Mars):="mars "; Nommoischaine(Avril) :="avril "; Nommoischaine(Mai):="mai "; Nommoischaine(Juin):="juin "; Nommoischaine(Juillet) :="juillet "; Nommoischaine(Aout) :="aout "; Nommoischaine(Septembre):="septembre"; Nommoischaine(Octobre):="octobre "; Nommoischaine(Novembre):="novembre "; Nommoischaine(Decembre) :="decembre "; end Init; procedure Repartionmois ( M : in Integer; Tabm : out Tmois ) is begin -- for i in 1..12 loop -- Tabm(i):=1; -- end loop; case M is when 1 => Tabm(1) :=Tabm(1)+1; when 2 => Tabm(2) := Tabm(2)+1; when 3 => Tabm(3) :=Tabm(3)+1; when 4 => Tabm(4) := Tabm(4)+1; when 5 => Tabm(5) :=Tabm(5)+1; when 6 => Tabm(6) := Tabm(6)+1; when 7 => Tabm(7) :=Tabm(7)+1; when 8 => Tabm(8) := Tabm(8)+1; when 9 => Tabm(9) :=Tabm(9)+1; when 10 => Tabm(10) := Tabm(10)+1; when 11 => Tabm(11) :=Tabm(11)+1; when 12 => Tabm(12) := Tabm(12)+1; when others => null; end case; end Repartionmois; procedure Calcul ( Annee : in Integer; Nb13 : out Integer; Tabm : out Tmois ) is K, Temp4 : Integer; begin for I in 1..12 loop Tabm(I):=0; end loop; Nb13 := 0; for A in Annee..Annee loop for M in 1..12 loop for Q in 13..13 loop K:=0; if M >2 then Temp4:= Q + 2*M + (3*(M + 1)/5) + A + (A/4) - (A/ 100) + ( A/400) + 2; K:= Temp4-((Temp4/7)*7); elsif M =1 then Temp4:= Q + 2*13 + (3*(13 + 1)/5) + (A-1) + ((A-1)/ 4) - (( A-1)/100) + ( (A-1)/400) + 2; K:= Temp4-((Temp4/7)*7); elsif M=2 then Temp4:= Q + 2*14 + (3*(14 + 1)/5) + (A-1) + ((A-1)/ 4) - (( A-1)/100) + ( (A-1)/400) + 2; K:= Temp4-((Temp4/7)*7); end if; if K <0 then K := -K; end if; if K=6 and Q = 13 then Nb13 := Nb13+1; Repartionmois(M,Tabm); end if; end loop; end loop; end loop; end Calcul; begin Init (Nommoischaine); loop loop Put_Line("entrer l'annee : "); Get(Annee); if Annee<1900 or Annee > 3000 then Bon := False; Put_Line( "Erreur : L'annee doit etre compris entre 1900 et 3000"); else Bon := True; end if; exit when Bon; end loop; Calcul(Annee, Nb13,Tabm); Put_Line("il y a "&Integer'Image(Nb13)&" vendredis 13 en"& Integer'Image(Annee)); J:=1; K :=1; for I in (Tnommois'First)..(Tnommois'Last) loop Put_Line(Nommoischaine(I)&" : "&Integer'Image(Tabm(J))); if Tabm(J)/=0 then Tableumois(k) :=Nommoischaine(I); K:=K+1; end if; J:=J+1; end loop; New_Line; Put_Line("Voulez vous continuer ? (O/N)"); Get(Continu); exit when Continu ='n'; end loop; exception when Data_Error => null; end Vendredi13;
Catégories : Informatique

1 commentaire

bab · 20 août 2005 à 20 h 59 min

codé un peu a l’arrache mais bon….

Les commentaires sont fermés.

Miniatures de site