Bonjour,
Je souhaite faire un programme qui trie par ordre alphabétique croissant des chaînes de caractères. Je crois que je me suis un peu perdu dans mon programme :
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
program tri;
type
	tableauChaine = array [1..5] of string;
 
var
	tab: tableauChaine;
	tampon:string;
	i : integer;
begin
	for i:=1 to 5 do
	begin
		writeln('Prénom ',i);
		readln(tab[i]);
	end;
 
	i:=2;
	while (tab[i]<tab[i-1]) and (i<=5) do
	begin
		writeln('tab[i] = ',tab[i]);
		writeln('tab[i-1] = ',tab[i-1]);
		writeln('i = ',i);
		tampon:=tab[i-1];
		tab[i-1]:=tab[i];
		tab[i]:=tampon;
		i:=i+1;
	end;
 
	for i:=1 to 5 do
	begin
		writeln('Prénom ',i,' : ',tab[i]);
	end;
	readln;
end.
Pouvez-vous m'aider ?