Autorisation : Membre
Nb de messages : 3
Inscrit le : Mer 07 Oct 2015, 21:32
Posté le : Mer 07 Oct 2015, 21:41
J'ai réalisé ce programme sur une TI-82 plus, je vous donne d'abord une version compatible pour quasiment toutes les calculettes et ensuite une version plus esthétique pour les calcultatrices contenant des caractères spéciaux comme les minuscules.
D'abord la version compatible avec toutes les calculettes (TI lycée bien sur hein ? )
Code
EffEcr
EffVar Liste1
EffVar Liste2
Menu("BASE PERSO ? ","NON",P,"OUI",0
Lbl 0
Input "BASE - ENTRE ",A
Input "BASE - SORTIE ",B
EffEcr
Goto c
Lbl P
Menu("CONVERTIR","DEC/BIN",1,"BIN/DEC",2,"DEC/HEXA",3,"HEXA/DEC",4,"BIN/HEXA",5,"HEXA/BIN",6
Lbl 1
10->A
2->B
Goto C
Lbl 2
2->A
10->B
Goto C
Lbl 3
10->A
16->B
Goto C
Lbl 4
16->A
10->B
Goto C
Lbl 5
2->A
16->B
GotoC
Lbl 6
16->A
2->B
Lbl C
Input "CONVERTIR ",Chaîne1
For(ø,1,longueur(Chaîne1
If sous-Chaîne(Chaîne,ø,1)="0
0->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="1
1->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="2
2->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="3
3->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="4
4->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="5
5->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="6
6->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="7
7->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="8
8->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="9
9->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="A
10->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="B
11->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="C
12->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="D
13->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="E
14->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="F
15->Liste1(ø
End
dim(Liste1->X
For(ø,1,dim(Liste1
X-1->X
Liste1(ø)*A^X->Liste1(ø
End
somme(Liste1->R
0->ø
EffVar Liste1
Effvar Liste2
Repeat non(Q
ø+1->ø
R/B->Q
Q-partDéc(Q->Q
R-BQ->Liste1(ø
Q->R
End
dim(Liste1->X
X->dim(L2
For(ø,1,dim(Liste1
Liste1(ø->Liste2(X
X-1->X
End
Liste2->Liste1
EffVar Liste2
" "->Chaîne1
For(ø,1,dim(Liste1
If Liste1(ø)=0:Chaîne1+"0->Chaîne1
If Liste1(ø)=1:Chaîne1+"1->Chaîne1
If Liste1(ø)=2:Chaîne1+"2->Chaîne1
If Liste1(ø)=3:Chaîne1+"3->Chaîne1
If Liste1(ø)=4:Chaîne1+"4->Chaîne1
If Liste1(ø)=5:Chaîne1+"5->Chaîne1
If Liste1(ø)=6:Chaîne1+"6->Chaîne1
If Liste1(ø)=7:Chaîne1+"7->Chaîne1
If Liste1(ø)=8:Chaîne1+"8->Chaîne1
If Liste1(ø)=9:Chaîne1+"9->Chaîne1
If Liste1(ø)=10:Chaîne1+"A->Chaîne1
If Liste1(ø)=11:Chaîne1+"B->Chaîne1
If Liste1(ø)=12:Chaîne1+"C->Chaîne1
If Liste1(ø)=13:Chaîne1+"D->Chaîne1
If Liste1(ø)=14:Chaîne1+"E->Chaîne1
If Liste1(ø)=15:Chaîne1+"F->Chaîne1
End
sous-Chaîne(Chaîne1,2,longueur(Chaîne1)-1->Chaîne1
Maintenant la version plus esthétique sur TI-82 Plus
Code
EffEcr
EffVar Liste1
EffVar Liste2
Menu("Base perso ? ","Non",P,"Oui",0
Lbl 0
Input "Base - Entré ",A
Input "Base - Sortie ",B
EffEcr
Goto c
Lbl P
Menu("Convertir","Déc/Bin",1,"Bin/Déc",2,"Déc/Hexa",3,"Hexa/Déc",4,"Bin/Hexa",5,"Hexa/Bin",6
Lbl 1
10->A
2->B
Goto C
Lbl 2
2->A
10->B
Goto C
Lbl 3
10->A
16->B
Goto C
Lbl 4
16->A
10->B
Goto C
Lbl 5
2->A
16->B
GotoC
Lbl 6
16->A
2->B
Lbl C
Input "Convertir ",Chaîne1
For(ø,1,longueur(Chaîne1
If sous-Chaîne(Chaîne,ø,1)="0
0->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="1
1->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="2
2->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="3
3->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="4
4->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="5
5->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="6
6->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="7
7->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="8
8->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="9
9->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="A
10->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="B
11->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="C
12->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="D
13->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="E
14->Liste1(ø
If sous-Chaîne(Chaîne,ø,1)="F
15->Liste1(ø
End
dim(Liste1->X
For(ø,1,dim(Liste1
X-1->X
Liste1(ø)*A^X->Liste1(ø
End
somme(Liste1->R
0->ø
EffVar Liste1
Effvar Liste2
Repeat non(Q
ø+1->ø
R/B->Q
Q-partDéc(Q->Q
R-BQ->Liste1(ø
Q->R
End
dim(Liste1->X
X->dim(L2
For(ø,1,dim(Liste1
Liste1(ø->Liste2(X
X-1->X
End
Liste2->Liste1
EffVar Liste2
" "->Chaîne1
For(ø,1,dim(Liste1
If Liste1(ø)=0:Chaîne1+"0->Chaîne1
If Liste1(ø)=1:Chaîne1+"1->Chaîne1
If Liste1(ø)=2:Chaîne1+"2->Chaîne1
If Liste1(ø)=3:Chaîne1+"3->Chaîne1
If Liste1(ø)=4:Chaîne1+"4->Chaîne1
If Liste1(ø)=5:Chaîne1+"5->Chaîne1
If Liste1(ø)=6:Chaîne1+"6->Chaîne1
If Liste1(ø)=7:Chaîne1+"7->Chaîne1
If Liste1(ø)=8:Chaîne1+"8->Chaîne1
If Liste1(ø)=9:Chaîne1+"9->Chaîne1
If Liste1(ø)=10:Chaîne1+"A->Chaîne1
If Liste1(ø)=11:Chaîne1+"B->Chaîne1
If Liste1(ø)=12:Chaîne1+"C->Chaîne1
If Liste1(ø)=13:Chaîne1+"D->Chaîne1
If Liste1(ø)=14:Chaîne1+"E->Chaîne1
If Liste1(ø)=15:Chaîne1+"F->Chaîne1
End
sous-Chaîne(Chaîne1,2,longueur(Chaîne1)-1->Chaîne1
Je ne vais pas expliquer ici ce que sont les bases ce serais trop long vous n'avez qu'a chercher sur Google.
Autorisation : Membre
Nb de messages : 373
Inscrit le : Jeu 23 Sep 2010, 16:05
Posté le : Dim 11 Oct 2015, 1:22
Voici ma version :
De la base 10 à X et inversement, pour X de 2 à 36.
Prgm AllBase V3 187 octets.
Code
:"0123456789ABCDEF->Chaîne0 ---- (Allez jusqu'à F pour base 16 et Z pour 36).
:EffEcr:0->N:0->R
:Input:"DE BASE ",X ---- (Base de départ ici).
:Input "A ",Y ---- (Base de sortie là).
:Input "N= ",Chaîne1 ---- (Valeur à convertir).
:longueur(Chaîne1->L
:For(Z,0,L-1
:carChaîne(Chaîne0,sous-Chaîne(Chaîne1,L-Z,1))-1
:R+X^ZRép->R
:End
:Repeat non(R
:N+1->N
:Output(8,17-N,sous-Chaîne(Chaîne0,1+R-Yent(R/Y),1
:ent(R/Y->R
:End
Et pour toi un lien traitant du même sujet avec les prgm des autres membres : http://tout82.free.fr/forum/sujet.php?sujet=3490&page=1
Merci pour ta version ce prgm et bienvenue parmi nous.
Ton prgm est bien trop long, surtout pour ceux qui recopient !
Ici nous t'aiderons et tu trouveras toutes les astuces pour optimiser au mieux tes prgm