1

confus ?question de and et de or?


Disp "Entrée 3 valeurs connues"
Prompt a,b,c,d,e,f

If a>0:h+1»h
If b>0:h+1»h
If c>0:h+1»h
If d>0:i+1»i
If e>0:i+1»i
If f>0:i+1»i

If i=3 Then
If d>(e+f):h+1»h
If e>(d+f):h+1»h
If f>(e+d):h+1»h
EndIf
If i+h =/= 3 or h=3 Then
Disp "Bad Bad Boy..."
Goto test
Else
Disp "Good Boy..."
EndIf
Goto menu


question
peut on optimiser les

If i=3 Then
If d>(e+f):h+1»h
If e>(d+f):h+1»h
If f>(e+d):h+1»h

If i+h =/= 3 or h=3 Then

pour en avoir qu'un mad

2

Premièrement, mets-les en cascade avec des else. Ca accélère un peu.
Autrement, je ne pense pas qu'on puisse optimiser ton truc plus que cela...
Site : http://www.phareaway.com/
Membre du groupe Phare Away et webmaster du site

3

when(a>0,1,0)+when(b>0,1,0)+when(c>0,1,0)->h
when(d>0,1,0)+when(e>0,1,0)+when(f>0,1,0)->i

If i=3 Then
If d>(e+f) or e>(d+f) or f>(e+d):h+1->h
EndIf


Je mets des or parce qu'on ne peut pas avoir plus d'un à la fois. Si i=3, d, e et f sont positifs, donc d>e+f => d>e et d>f => e<d+f et f<e+d.
[edit]Edité par Kevin Kofler le 11-01-2002 à 15:56:49[/edit]
avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité