Le fichier source est ${UPS_HOME}/upsvtm/demo/${UPS_LANGUAGE}/complexe.upl.
upscmp Source=complexe.upl
complexe
upssng Source=complexe.upl
Source Composant "Exemple d'emploi du type Complexe" Version 4.0.0;
ImporterModule
/************/
UpsMat(<UpsMat.upi>, ImporterDefinitions);
Principal
/*******/
Variable
/******/
A : Nul Ou Complexe;
B : Complexe;
Debut
A=Complexe(1.0, 1.0);
Ecran.Ecrire(A.VersCaractere());
B=Complexe(1.0 ,1.0);
Ecran.Ecrire(B.VersCaractere());
A=A+1.0;
Ecran.Ecrire(A.VersCaractere());
B=B+1.0;
Ecran.Ecrire(B.VersCaractere());
A=A-10.0;
Ecran.Ecrire(A.VersCaractere());
B=B-10.0;
Ecran.Ecrire(B.VersCaractere());
A=A*10.0;
Ecran.Ecrire(A.VersCaractere());
B=B*10.0;
Ecran.Ecrire(B.VersCaractere());
A=A/5.0;
Ecran.Ecrire(A.VersCaractere());
B=B/5.0;
Ecran.Ecrire(B.VersCaractere());
A=A^3.0;
Ecran.Ecrire(A.VersCaractere());
B=B^3.0;
Ecran.Ecrire(B.VersCaractere());
A=Complexe(1.0, 1.0);
Ecran.Ecrire(A.VersCaractere());
B=Complexe(1.0, 1.0);
Ecran.Ecrire(B.VersCaractere());
A+=1.0;
Ecran.Ecrire(A.VersCaractere());
B+=1.0;
Ecran.Ecrire(B.VersCaractere());
A-=10.0;
Ecran.Ecrire(A.VersCaractere());
B-=10.0;
Ecran.Ecrire(B.VersCaractere());
A*=10.0;
Ecran.Ecrire(A.VersCaractere());
B*=10.0;
Ecran.Ecrire(B.VersCaractere());
A^=3.0;
Ecran.Ecrire(A.VersCaractere());
B^=3.0;
Ecran.Ecrire(B.VersCaractere());
A=Complexe(1, 1);
Ecran.Ecrire(A.VersCaractere());
B=Complexe(1, 1);
Ecran.Ecrire(B.VersCaractere());
A=A+1;
Ecran.Ecrire(A.VersCaractere());
B=B+1;
Ecran.Ecrire(B.VersCaractere());
A=A-10;
Ecran.Ecrire(A.VersCaractere());
B=B-10;
Ecran.Ecrire(B.VersCaractere());
A=A*10;
Ecran.Ecrire(A.VersCaractere());
B=B*10;
Ecran.Ecrire(B.VersCaractere());
A=A/5;
Ecran.Ecrire(A.VersCaractere());
B=B/5;
Ecran.Ecrire(B.VersCaractere());
A=A^3;
Ecran.Ecrire(A.VersCaractere());
B=B^3;
Ecran.Ecrire(B.VersCaractere());
A=Complexe(1, 1);
Ecran.Ecrire(A.VersCaractere());
B=Complexe(1, 1);
Ecran.Ecrire(B.VersCaractere());
A+=1;
Ecran.Ecrire(A.VersCaractere());
B+=1;
Ecran.Ecrire(B.VersCaractere());
A-=10;
Ecran.Ecrire(A.VersCaractere());
B-=10;
Ecran.Ecrire(B.VersCaractere());
A*=10;
Ecran.Ecrire(A.VersCaractere());
B*=10;
Ecran.Ecrire(B.VersCaractere());
A^=3;
Ecran.Ecrire(A.VersCaractere());
B^=3;
Ecran.Ecrire(B.VersCaractere());
A=Complexe(Decimal(1), Decimal(1));
Ecran.Ecrire(A.VersCaractere());
B=Complexe(Decimal(1), Decimal(1));
Ecran.Ecrire(B.VersCaractere());
A=A+Decimal(1);
Ecran.Ecrire(A.VersCaractere());
B=B+Decimal(1);
Ecran.Ecrire(B.VersCaractere());
A=A-Decimal(10);
Ecran.Ecrire(A.VersCaractere());
B=B-Decimal(10);
Ecran.Ecrire(B.VersCaractere());
A=A*Decimal(10);
Ecran.Ecrire(A.VersCaractere());
B=B*Decimal(10);
Ecran.Ecrire(B.VersCaractere());
A=A/Decimal(5);
Ecran.Ecrire(A.VersCaractere());
B=B/Decimal(5);
Ecran.Ecrire(B.VersCaractere());
A=A^Decimal(3);
Ecran.Ecrire(A.VersCaractere());
B=B^Decimal(3);
Ecran.Ecrire(B.VersCaractere());
A=Complexe(Decimal(1), Decimal(1));
Ecran.Ecrire(A.VersCaractere());
B=Complexe(Decimal(1), Decimal(1));
Ecran.Ecrire(B.VersCaractere());
A+=Decimal(1);
Ecran.Ecrire(A.VersCaractere());
B+=Decimal(1);
Ecran.Ecrire(B.VersCaractere());
A-=Decimal(10);
Ecran.Ecrire(A.VersCaractere());
B-=Decimal(10);
Ecran.Ecrire(B.VersCaractere());
A*=Decimal(10);
Ecran.Ecrire(A.VersCaractere());
B*=Decimal(10);
Ecran.Ecrire(B.VersCaractere());
A^=Decimal(3);
Ecran.Ecrire(A.VersCaractere());
B^=Decimal(3);
Ecran.Ecrire(B.VersCaractere());
A++;
Ecran.Ecrire(A.VersCaractere());
B++;
Ecran.Ecrire(B.VersCaractere());
A--;
Ecran.Ecrire(A.VersCaractere());
B--;
Ecran.Ecrire(B.VersCaractere());
++A;
Ecran.Ecrire(A.VersCaractere());
++B;
Ecran.Ecrire(B.VersCaractere());
--A;
Ecran.Ecrire(A.VersCaractere());
--B;
Ecran.Ecrire(B.VersCaractere());
Si A==1.0 Alors
Ecran.Ecrire("A==1.0");
Fin Si
Si A!=1.0 Alors
Ecran.Ecrire("A!=1.0");
Fin Si
Si B==1.0 Alors
Ecran.Ecrire("B==1.0");
Fin Si
Si B!=1.0 Alors
Ecran.Ecrire("B!=1.0");
Fin Si
Si A==1 Alors
Ecran.Ecrire("A==1");
Fin Si
Si A!=1 Alors
Ecran.Ecrire("A!=1");
Fin Si
Si B==1 Alors
Ecran.Ecrire("B==1");
Fin Si
Si B!=1 Alors
Ecran.Ecrire("B!=1");
Fin Si
Si A==Decimal(1) Alors
Ecran.Ecrire("A==1");
Fin Si
Si A!=Decimal(1) Alors
Ecran.Ecrire("A!=1");
Fin Si
Si B==Decimal(1) Alors
Ecran.Ecrire("B==1");
Fin Si
Si B!=Decimal(1) Alors
Ecran.Ecrire("B!=1");
Fin Si
Fin Principal