Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.morbleu.com/random-link.xml?ei=3%7C4%7C9%7C11%7C13%7C15%7C17%7C19%7C21%7C27%7C28%7C33%7C37%7C39%7C41%7C47%7C52%7C53%7C55%7C57%7C59%7C66%7C68%7C70%7C79%7C81%7C84%7C86%7C91%7C93%7C95%7C97%7C98%7C101%7C104%7C111%7C117%7C118%7C126%7C128%7C130%7C135%7C139%7C143%7C145%7C147%7C148%7C152%7C156%7C158%7C159%7C161%7C163%7C166%7C168%7C172%7C177%7C184%7C189%7C191%7C193%7C198%7C202%7C204%7C205%7C207%7C211%7C214%7C216%7C217%7C219%7C223%7C225%7C226%7C228%7C230%7C233%7C234%7C236%7C238%7C240%7C242%7C244%7C247%7C249%7C250%7C252%7C255%7C256%7C259%7C260%7C263%7C266%7C269%7C270%7C272%7C276%7C279%7C281%7C282%7C284%7C286%7C288%7C290%7C292%7C295%7C297%7C298%7C301%7C308%7C:6: parser error : Entity 'ldquo' not defined in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: <description>&ldquo; Sorte de jurement en usage m&ecirc;me parmi les gens de bo in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.morbleu.com/random-link.xml?ei=3%7C4%7C9%7C11%7C13%7C15%7C17%7C19%7C21%7C27%7C28%7C33%7C37%7C39%7C41%7C47%7C52%7C53%7C55%7C57%7C59%7C66%7C68%7C70%7C79%7C81%7C84%7C86%7C91%7C93%7C95%7C97%7C98%7C101%7C104%7C111%7C117%7C118%7C126%7C128%7C130%7C135%7C139%7C143%7C145%7C147%7C148%7C152%7C156%7C158%7C159%7C161%7C163%7C166%7C168%7C172%7C177%7C184%7C189%7C191%7C193%7C198%7C202%7C204%7C205%7C207%7C211%7C214%7C216%7C217%7C219%7C223%7C225%7C226%7C228%7C230%7C233%7C234%7C236%7C238%7C240%7C242%7C244%7C247%7C249%7C250%7C252%7C255%7C256%7C259%7C260%7C263%7C266%7C269%7C270%7C272%7C276%7C279%7C281%7C282%7C284%7C286%7C288%7C290%7C292%7C295%7C297%7C298%7C301%7C308%7C:6: parser error : Entity 'ecirc' not defined in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: <description>&ldquo; Sorte de jurement en usage m&ecirc;me parmi les gens de bo in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.morbleu.com/random-link.xml?ei=3%7C4%7C9%7C11%7C13%7C15%7C17%7C19%7C21%7C27%7C28%7C33%7C37%7C39%7C41%7C47%7C52%7C53%7C55%7C57%7C59%7C66%7C68%7C70%7C79%7C81%7C84%7C86%7C91%7C93%7C95%7C97%7C98%7C101%7C104%7C111%7C117%7C118%7C126%7C128%7C130%7C135%7C139%7C143%7C145%7C147%7C148%7C152%7C156%7C158%7C159%7C161%7C163%7C166%7C168%7C172%7C177%7C184%7C189%7C191%7C193%7C198%7C202%7C204%7C205%7C207%7C211%7C214%7C216%7C217%7C219%7C223%7C225%7C226%7C228%7C230%7C233%7C234%7C236%7C238%7C240%7C242%7C244%7C247%7C249%7C250%7C252%7C255%7C256%7C259%7C260%7C263%7C266%7C269%7C270%7C272%7C276%7C279%7C281%7C282%7C284%7C286%7C288%7C290%7C292%7C295%7C297%7C298%7C301%7C308%7C:6: parser error : Entity 'rdquo' not defined in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: &ldquo; Sorte de jurement en usage m&ecirc;me parmi les gens de bon ton. &rdquo; in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.morbleu.com/random-link.xml?ei=3%7C4%7C9%7C11%7C13%7C15%7C17%7C19%7C21%7C27%7C28%7C33%7C37%7C39%7C41%7C47%7C52%7C53%7C55%7C57%7C59%7C66%7C68%7C70%7C79%7C81%7C84%7C86%7C91%7C93%7C95%7C97%7C98%7C101%7C104%7C111%7C117%7C118%7C126%7C128%7C130%7C135%7C139%7C143%7C145%7C147%7C148%7C152%7C156%7C158%7C159%7C161%7C163%7C166%7C168%7C172%7C177%7C184%7C189%7C191%7C193%7C198%7C202%7C204%7C205%7C207%7C211%7C214%7C216%7C217%7C219%7C223%7C225%7C226%7C228%7C230%7C233%7C234%7C236%7C238%7C240%7C242%7C244%7C247%7C249%7C250%7C252%7C255%7C256%7C259%7C260%7C263%7C266%7C269%7C270%7C272%7C276%7C279%7C281%7C282%7C284%7C286%7C288%7C290%7C292%7C295%7C297%7C298%7C301%7C308%7C:6: parser error : Entity 'eacute' not defined in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: e jurement en usage m&ecirc;me parmi les gens de bon ton. &rdquo; (Littr&eacute; in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.morbleu.com/random-link.xml?ei=4%7C17%7C28%7C37%7C39%7C47%7C52%7C68%7C81%7C101%7C147%7C166%7C168%7C172%7C184%7C193%7C198%7C207%7C216%7C219%7C233%7C234%7C256%7C272%7C279%7C281%7C292%7C298%7C:6: parser error : Entity 'ldquo' not defined in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: <description>&ldquo; Sorte de jurement en usage m&ecirc;me parmi les gens de bo in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.morbleu.com/random-link.xml?ei=4%7C17%7C28%7C37%7C39%7C47%7C52%7C68%7C81%7C101%7C147%7C166%7C168%7C172%7C184%7C193%7C198%7C207%7C216%7C219%7C233%7C234%7C256%7C272%7C279%7C281%7C292%7C298%7C:6: parser error : Entity 'ecirc' not defined in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: <description>&ldquo; Sorte de jurement en usage m&ecirc;me parmi les gens de bo in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.morbleu.com/random-link.xml?ei=4%7C17%7C28%7C37%7C39%7C47%7C52%7C68%7C81%7C101%7C147%7C166%7C168%7C172%7C184%7C193%7C198%7C207%7C216%7C219%7C233%7C234%7C256%7C272%7C279%7C281%7C292%7C298%7C:6: parser error : Entity 'rdquo' not defined in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: &ldquo; Sorte de jurement en usage m&ecirc;me parmi les gens de bon ton. &rdquo; in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.morbleu.com/random-link.xml?ei=4%7C17%7C28%7C37%7C39%7C47%7C52%7C68%7C81%7C101%7C147%7C166%7C168%7C172%7C184%7C193%7C198%7C207%7C216%7C219%7C233%7C234%7C256%7C272%7C279%7C281%7C292%7C298%7C:6: parser error : Entity 'eacute' not defined in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: e jurement en usage m&ecirc;me parmi les gens de bon ton. &rdquo; (Littr&eacute; in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.morbleu.com/random-link.xml:6: parser error : Entity 'ldquo' not defined in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: <description>&ldquo; Sorte de jurement en usage m&ecirc;me parmi les gens de bo in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.morbleu.com/random-link.xml:6: parser error : Entity 'ecirc' not defined in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: <description>&ldquo; Sorte de jurement en usage m&ecirc;me parmi les gens de bo in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.morbleu.com/random-link.xml:6: parser error : Entity 'rdquo' not defined in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: &ldquo; Sorte de jurement en usage m&ecirc;me parmi les gens de bon ton. &rdquo; in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.morbleu.com/random-link.xml:6: parser error : Entity 'eacute' not defined in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: e jurement en usage m&ecirc;me parmi les gens de bon ton. &rdquo; (Littr&eacute; in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home.10.2/cybwarri/ixweb/include/libs/lib_random_link.php on line 77
Turbo Pascal - Les constantes
  Accueil Accueil     Membres Membres     Forum Forum     Articles Articles     Download Download     Sondages Sondages     Outils Outils     Scriptland Scriptland     ProgBoards ProgBoards     FR  
  Morbleu ! Morbleu ! 
Cours de programmation, code source, aide au développement, forums d'entraide - CybWarrior

login Bug Contact RSS
login bug contact RSS


| Internet |
   Créer son site web

| Langages |
   HTML
   JavaScript
   Langage C
   PHP
   QBasic
   Turbo Pascal

| Programmation |
   Algorithmie
   Maths appliquées
   Windows

| Trucs & astuces |
   Lexique
   Oeufs de Pâques (easter eggs)
   Registre et Windows

| Téléchargements |
   Flash
   Freeware
   JavaScript
   NASM
   PHP
   QBasic
   Turbo Pascal
   Visual Basic / VBScript

Turbo Pascal - Les constantes

Autre langage disponible pour cet article : FR
Rubrique : Turbo Pascal
lundi 25 mars 2002 18:42

Voir les commentaires pour Turbo Pascal - Les constantes
Autres articles :
- Turbo Pascal - Introduction au Turbo Pascal
- Turbo Pascal - Ecrire sur l'écran
- Turbo Pascal - Un peu de maths
- Turbo Pascal - Les commentaires
- Turbo Pascal - Les variables
- Turbo Pascal - Les constantes
- Turbo Pascal - Entrée de données
- Turbo Pascal - Structure conditionnelle
- Turbo Pascal - Les cas
- Turbo Pascal - Branchements
- Turbo Pascal - Les boucles
- Turbo Pascal - Procédures et fonctions
- Turbo Pascal - Les unités
- Turbo Pascal - Les tableaux
- Turbo Pascal - Les maths
- Turbo Pascal - Le traitement du texte
- Turbo Pascal - Affichage du texte
- Turbo Pascal - Le son
- Turbo Pascal - Graphismes
- Turbo Pascal - L'unité Graph et le texte
- Turbo Pascal - Les types personalisés
- Turbo Pascal - Les pointeurs
- Turbo Pascal - Les objets
- Turbo Pascal - Les ensembles
<< - >>

Le contraire, si on peut appeler ça ainsi, d'une variable se nomme une constante. Par définition, une constante est un élement qui ne variera pas.
Par exemple, pour des calculs de mécanique ou scientifiques, on peut avoir besoin d'utiliser la gravité. En principe, on utilise 9.81. Nous allons donc définir une constante que nous appelerons Gravite.
La déclaration ce fait à l'aide du mot-clef const et avant les déclarations de variables :
program CalculMasse;

const Gravite = 9.81;       { Définition de la constante 'Gravite' }

var Poids : Real;           { Deux variables }
    Masse : Real;

begin
  Masse := 50;              { 50 kg }
  Poids := Masse * Gravite; { P = M * G }
  write('Le poids d''un corps ayant une masse de 50 kg est de ', Poids, ' Newtons.');
end.
Remarquez qu'ici, on utilise pas l'opérateur d'affectation (:=) vu précedement, mais simplement le égual (=). Une constante peut aussi être du type texte, comme le montre l'exemple suivant :
const Pays = 'France';

begin
  write(Pays);
end.
Contrairement aux variables, il n'est nullement besoin de spécifier le type de la constante. On peut tout de même le faire, en utilisant le double points, comme pour les variables. Il ne faut cependant pas oublier d'affecter la valeur :
program CalculMasse;

const Gravite : Real = 9.81;  { Définition de la constante 'Gravite'
 et de son type (Real) }

var Poids : Real;             { Deux variables }
    Masse : Real;

begin
  Masse := 50;                { 50 kg }
  Poids := Masse * Gravite;   { P = M * G }
  write('Le poids d''un corps ayant une masse de 50 kg est de ', Poids, ' Newtons.');
end.


Voir les commentaires pour Turbo Pascal - Les constantes
 06 juillet 2008 | Version 4.0.0 | © 2001 - 2007