FestivAlgo/aide.php

167 lines
5.6 KiB
PHP

<?php
$page_title = 'Aide';
require_once('includes/header.php');
?>
<article id="help_page">
<div class="layout_float">
<div>
<h2>&bull; Qu'est-ce qu'un <em>algorithme</em> ?</h2>
<p class="text_block">
Le mot <em>"algorithme"</em> vient du nom du mathématicien Persan <strong>Al-Khuwarizmi</strong>, qui inventa une méthode, au début du IXème siècle, pour résoudre des équations pas à pas.<br />
Un <em>algorithme</em> est une suite d'opérations appliquées dans un ordre donné.
</p>
</div>
<img src="assets/img/help/schema_algo.png" title="Schéma des 3 phases d'un algorithme" alt="Schéma d'un algorithme" />
</div>
<h2>&bull; Variables et affectation</h2>
<div class="text_block">
<p>
Dans un <em>algorithme</em>, on commence par <strong>l'entrée des données</strong>. Chacune de ces données est stockée dans la mémoire de la <strong>calculatrice</strong> ou de l'<strong>ordinateur</strong> à un emplacement nommé <strong>variable</strong> et est repérée par une lettre.<br />
Les <strong>instructions</strong> que l'on peut pratiquer avec une <strong>variable</strong> sont :
</p>
<p>
- <strong><b>la saisie</b></strong> : on demande à l'utilisateur de donner une valeur à une <strong>variable</strong>.
</p>
<div class="code_example_container">
<div class="code_example code_algo">
Saisir A
<small>Algorithme</small>
</div>
<div class="code_example code_casio">
? &rarr; A
<small>Casio</small>
</div>
<div class="code_example code_ti">
Input A
<small>TI</small>
</div>
</div>
<div class="code_result">
<span>Exécution :</span>
<input onkeypress='if(event.keyCode == 13) lire("a", 1, 0, 1);' autofocus size='7' maxlength='10' id='lire1' placeholder='A =' required rows='1' cols='5'/>
</div>
<p>
- <strong><b>l'affectation</b></strong> : on donne à la <strong>variable</strong> une certaine valeur ou le résultat d'un calcul.
</p>
<div class="code_example_container">
<div class="code_example code_algo">
A Prend_la_valeur 3 * 5
<small>Algorithme</small>
</div>
<div class="code_example code_casio">
3 * 5 &rarr; A
<small>Casio</small>
</div>
<div class="code_example code_ti">
3 * 5 &rarr; A
<small>TI</small>
</div>
</div>
<p>
- <strong><b>l'affichage</b></strong> : on affiche le contenu de la <strong>variable</strong>.
</p>
<div class="code_example_container">
<div class="code_example code_algo">
Afficher A
<small>Algorithme</small>
</div>
<div class="code_example code_casio">
A&ang;
<small>Casio</small>
</div>
<div class="code_example code_ti">
Disp A
<small>TI</small>
</div>
</div>
<div class="code_result">
<span>Exécution :</span>
15
</div>
</div>
<div class="layout_float">
<div>
<h2>&bull; Les conditions</h2>
<p class="text_block">
La résolution de certains problèmes conduit parfois à une situation dans laquelle la décision prise est soumise à <strong>condition</strong>.<br />
Si la <strong>condition</strong> est vérifiée, on effectue une première tâche, sinon on effectue une seconde tâche.
</p>
</div>
<img src="assets/img/help/schema_condition.png" title="Schéma d'une condition" alt="Schéma d'une condition" />
</div>
<div class="text_block">
<div class="code_example_container">
<div class="code_example code_algo">
Si A = 1<br />Alors ...<br />(Sinon ...)<br />Fin_si
<small>Algorithme</small>
</div>
<div class="code_example code_casio">
If A = 1<br />Then ...<br />(Else ...)<br />IfEnd
<small>Casio</small>
</div>
<div class="code_example code_ti">
If A = 1<br />Then ...<br />(Else ...)<br />End
<small>TI</small>
</div>
</div>
<p>Le "<em>Sinon</em>" n'est pas systématique. Sans cette <strong>instruction</strong>, si la <strong>condition</strong> n'est pas vérifiée, la tâche n'est pas effectuée et l'<em>algorithme</em> passe à l'<strong>instruction</strong> suivante.</p>
</div>
<h2>&bull; Les boucles</h2>
<div class="text_block">
<p>
Pendant l'<strong>exécution</strong> d'un <em>programme</em>, il est possible d'avoir à réaliser plusieurs fois de suites la même tâche.<br />
Il existe deux types de <strong>boucles</strong> :
</p>
<p>
- <strong><b>la boucle conditionelle</b></strong> : on répète les mêmes <strong>instructions</strong> tant qu'une <strong>condition</strong> est remplie.
</p>
<div class="code_example_container">
<div class="code_example code_algo">
Tant_que A = 1<br />...<br />...<br />Fin_tant_que
<small>Algorithme</small>
</div>
<div class="code_example code_casio">
While A = 1<br />...<br />...<br />End
<small>Casio</small>
</div>
<div class="code_example code_ti">
While A = 1<br />...<br />...<br />WhileEnd
<small>TI</small>
</div>
</div>
<p>
- <strong><b>la boucle itérative</b></strong> : on répète les mêmes <strong>instructions</strong> un certain nombre de fois.
</p>
<div class="code_example_container">
<div class="code_example code_algo">
Pour A Allant_de 0 à 10<br />...<br />...<br />Fin_pour
<small>Algorithme</small>
</div>
<div class="code_example code_casio">
For 0 &rarr; A To 10<br />...<br />...<br />Next
<small>Casio</small>
</div>
<div class="code_example code_ti">
For(A,0,10)<br />...<br />...<br />End
<small>TI</small>
</div>
</div>
</div>
</article>
<?php
require_once('includes/footer.php');
?>