Bonjour,

Voilà mon programme mais quand je l’exécute, il y a une erreur. Je ne la trouve pas. SVP aidez-moi, c'est important.
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
program Calculator;
Uses SysUtils;
var 	exprition:string;
	pile: array of String;
	size: integer;
	i,j: integer;
	cresult: real;	
 
//-------------------------------------
function add(op1,op2:real):real;
begin
	add := op1 + op2;	
end;
 
//-------------------------------------
function sub(op1,op2:real):real;
begin
	sub := op1 - op2;
end;
 
//-------------------------------------
function mult(op1,op2:real):real;
begin
	mult := op1 * op2;
end;
 
//-------------------------------------
function dev(op1,op2:real):real;
var result: real;
begin
	if(op2 = 0) then 
	begin
		result := 0;
		writeln('Pas divisible par zéro');
	end
	else
	begin
		result := op1 / op2;
	end;
 
	dev := result;
end;
 
//-------------------------------------
function calculer(operation: String;op1,op2: real):real; 
var	result: real;
	coperation: char;
begin
	coperation := operation[1];
	case coperation of
	'+':begin
		result := add(op1,op2);
	end;
	'-':begin
		result := sub(op1,op2);
	end;
	'*':begin
		result := mult(op1,op2);
	end;
	'/':begin
		result := dev(op1,op2);
	end;
	end;
	calculer := result;
end;
 
//-------------------------------------
begin
	write('Entre une expression (Postfix) sans espaces : ');
	readln(exprition);
 
	size := Length(exprition);
	SetLength(pile,size);
 
	for i := 1 to size do
	begin
		pile[i-1] := exprition[i];
	end;
 
	j := 0;
	i := 0;
	while i <> (size + 1) do
	begin
		if((pile[i] = '-') or (pile[i] = '+') or (pile[i] = '*') or (pile[i] = '/')) then
		begin
			if(j = 2) then 
			begin
				pile[i] := FloatToStr(calculer(pile[i],StrToFloat(pile[i-2]),StrToFloat(pile[i-1])));
				cresult := StrToFloat(pile[i]);
				j := -1;
				Dec(i);		
			end;
			if(j = 3) then
			begin
				pile[i] := FloatToStr(calculer(pile[i],StrToFloat(pile[i-2]),StrToFloat(pile[i-1])));
				cresult := StrToFloat(pile[i]); 
				j := -1;
				Dec(i);	
			end;
			if(j = 1) then
			begin
				pile[i] := FloatToStr(calculer(pile[i],StrToFloat(pile[i-4]),StrToFloat(pile[i-1])));
				cresult := StrToFloat(pile[i]); 
				j := -1;
				Dec(i);	
			end;
		end;
		Inc(j);
		Inc(i);
	end;
	writeln('Le résultat est : ',cresult:0:2);
end.