ALGORITHMIC
ALGORITHMIC LANGULANGUAGE C LANGUAGE
ANGUAGE begin {
Main Program ALGORITHM <identificateur> int main () bloc bloc ;
<déclarations> { endwhile }
BEGIN <déclarations>; do do
<Corps: intructions> <Corps: instructions>; begin {
END return 0; bloc bloc ;
} end }
Declarations
Declarations while (condition) while (condition)
Variable VAR <identificateur> : TYPE TYPE <identificateur> ; Function FUNCTION <nom_fonction>(<P1>:<T1>, <P2>:<T2>,… <type_retour> <nom_fonction>(<T1> <p1>, <T2> <p2>, … , <Tn> <pN>)
Constant CONST <Identificateur> = valeur CONST TYPE <identificateur> = valeur; <Pn>:Tn) : <type_retour> {
TYPE <déclarations> <declaration>;
Integer integer short [int]1 , unsigned short [int] , int , unsigned [int], long [int], unsigned BEGIN <Corps: intructions>;
long [int], long long [int], unsigned long long [int] <Corps: intructions> return (<resultat>);
Real
eal real float, double , long double RETURN (<resultat>) }
Caracter
Caracter char char, unsigned char END
Boole
Boolean BOOLEAN bool2 Proce
Procedure PROCEDURE <nomproc>([VAR]<P1>:<T1>, void <nomproc>(<T1> [*] <P1>, <T2> [*] <P2>, … , <Tn> [*] <PN>)
enume
numerated TYPE <Id> = ( a1, a2, …, an) enum <Id>{a1, a2, …, an}; [VAR]<P2>:<T2>,… [VAR]<Pn>:Tn) {
<déclarations> <declaration>;
Interval TYPE <Id> = C1 .. Cn BEGIN <Corps: intructions>;
Array Id : ARRAY [Tmax] OF typelt typelt Id [Tmax]; <Corps: intructions> }
String chaine : ARRAY [Tmax] OF char char chaine [Tmax]; END
char * chaine; Standards Libraries in C (#include<….>)
Structure TYPE NomEnreg = STRUCTURE struct NomEnreg stdio.h scanf, printf
(record) BEGIN { stdlib.h abs, div,
Champ1: type1 type1 Champ1; math.h pow, sqrt, fabs, fmod, exp, log, sin, cos, tan
Champ2: type2 type2 Champ2; ctype.h
…….. …….. string.h
Champn: typen typen Champn;
END };
1 [int] facultatif
2 <stdbool.h>
Operat
Operato
rators
Assignment =, +=, -=, *=, /=, %=
Arithme
Arithmetic
tic +, -, *, /, mod, div +, -, *, /, %
Logic
Logic NOT, AND, OR, !, &&, ||,
Relational
Relational <, <=, >, >=, =, ≠, = =, !=, <, <=, >, >=
Reading scan ([f],var1 , var2 , … , varn ) scanf (format, & var1, & var2,..., & varn )
Writing print ([f],exp1 , exp2 , … , expn ) printf (format, exp1 , exp2 , … , expn )
Alternatives if (condition) then if (condition)
Actions BEGIN {
bloc bloc ;
if if
ENDif }
[else [ else
BEGIN {
bloc ;
blocelse else
}
ENDelse
]
]
switch (expression) switch (expression)
BEGIN {
case c1 : begin bloc1 end case c1 : bloc1 ; [break;]
case c : begin bloc end case c : bloc ; [break;]
2 2 2 2
. .
case c : beginbloc end case c : bloc ; [break;]
n n n n
[default: begin bloc end] [default: bloc ;]
default default
END }
switch
Ite
Iteratives for cpt vi to vf [step pas] do for(cpt=vi ;cpt<=vf ;cpt=cpt+pas)
Actions begin {
bloc bloc ;
endfor }
while (condition) do while (condition)