Bonjour,
je voudrais transformer cet algorithme pascal en algorithme simple et que vous m'expliquiez sa simulation
Code pascal : 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 program tri(input,output); uses wincrt; const m=5; var t:array[1..m] of real; i,j,rangmin:integer; min:real; begin writeln('introduisezz les element du tableau'); for i:=1 to m do readln(t[i]); for i:=1 to m do begin min:=t[i];rangmin:=i; for j:=i+1 to m do begin if t[j]<min then begin min:=t[j]; rangmin:=j; end; end; t[rangmin]:=t[i]; t[i]:=min; end; for i:=1 to m do writeln(t[i]:5:2); end.
voila mon algorithme
algorithme tri
la simulationconstant m=5; variable t:tableau[1..m] en reel i,j,rangmin:entier min:reel debut ecrire('introduisezz les element du tableau') pour i de1 a m faire lire(t[i]); pour i de1 a m faire debut min recoit t[i];rangmin recoit i; pour j de i+1 a m faire debut si t[j]<min alors debut min recoit t[j]; rangmin recoit j; finpour fin pour t[rangmin] recoit t[i]; t[i] recoit min; fin pour for i:=1 to m do ecrire(t[i]); fin.
i j min rangmin
les photos
Merci
Partager