// à partir d'ici, les définitions valables pour tous /* ========= bloc ========= DEBUT instructions; FIN; */ #define DEBUT { #define FIN } /* ========= définition de variable/constante/fonction ========= DEFINIR définition; */ #define DEFINIR /* ========= conditionnelle SI ========= SI condition ALORS SI condition ALORS instructions; instructions; SINON FINSI; instructions; FINSI; */ #define SI if( #define ALORS ){ #define SINON }else{ #define SINONSI }else if( #define FINSI } /* ========= sélecteur de cas SELON ========= SELON expression FAIRE CAS expression : instructions; => peut contenir FINCAS AUTREMENT : instructions; FINSEL; */ #define SELON switch( #define FAIRE ){ #define CAS case #define FINCAS break #define AUTREMENT default #define FINSEL } /* ========= pour toutes les boucles ========= RELANCER; ARRETER; */ #define RELANCER continue #define ARRETER break /* ========= boucle TANTQUE ========= TANTQUE condition FAIRE instructions; FINTANT; */ #define TANTQUE while( // FAIRE défini dans le sélecteur de cas SELON #define FINTANT } /* ========= boucle REPETER ========= REPETER REPETER instructions; instructions; JUSQUA condition FINREP; REFAIRESI condition FINREP; */ #define REPETER do{ #define JUSQUA }while(!( #define REFAIRESI }while(( #define FINREP )) /* ========= boucle POUR ========= DEPUIS affectation QUAND condition PROCHAIN instruction FAIRE instructions; FINPOUR; */ #define DEPUIS {for( #define QUAND ; #define PROCHAIN ; // FAIRE défini dans le sélecteur de cas SELON #define FINPOUR }} /* ========= affichage ========= AFFICHER expression1 << expression2 << .. << expressionk; */ #define AFFICHER cout<< /* ========= saisie ========= DEMANDER variable1 >> variable2 >> .. >> variablek; */ #define DEMANDER cin>> /* ========= exceptions ========= ESSAYER instructions; SIEXCEPTION déclaration FAIRE instructions; ... SIEXCEPTION déclaration FAIRE instructions; FINESS; EXCEPTION expression; */ #define ESSAYER try{ #define SIEXCEPTION }catch( // FAIRE déjà défini dans la sélection par cas #define FINESS } #define EXCEPTION throw /* ========= définition de fonction ========= FONCTION type nom PARAMETRES liste de déclarations CORPS instructions FINFONC; RESULTAT expression; TERMINER; */ #define FONCTION #define PARAMETRES ( #define CORPS ){ #define FINFONC } #define RESULTAT return #define TERMINER return /* ========= définition de type ========= SYNONYME type nom; ENUMERATION nom DEBUT liste de noms FIN; ENREGISTREMENT nom DEBUT liste de déclarations FIN; */ #define SYNONYME typedef #define ENUMERATION enum #define ENREGISTREMENT struct #define VARIANT union // à partir d'ici, quelques définitions personnelles SYNONYME int Entier; SYNONYME double Reel; SYNONYME unsigned int Naturel; SYNONYME bool Booleen; SYNONYME void Rien; #define Vrai true #define Faux false