1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| <html>
<Head>
<title> Premiere page </title>
</head>
<body>
<h1 align="center"><u> Les Graphes </u></h1>
<br/>
<br/>
<?php
echo "<font color=\"#800080\">Aujourd'hui nous sommes le : </font>" .date('d/m/Y');
echo "<br><font color=\"#800080\"> Il est :</font> " .date('H \h i \m\i\n s \s\e\c ');
?>
<center>
<form method="post" action="Graphe.php">
Entrez le nombre de Sommet : <input type="text" name="som" />
<br>
<input type="submit" name="ok" value="ok" />
</form>
</center>
<?php
if(isset($_POST['ok']))
{ $n=''; if(isset($_POST['som'])) { $n=($_POST['som'] ); }
//diemension de la matrice
$mat = array();
//1er appel de la fonction
//$mat = matrice
//$n = dimension
//0 = niveau courant
create_recur_mat($mat, $n, 0);
function create_recur_mat($current_mat, $n, $current_n) {
if ($n == $current_n) { //condition de sortie dimension courante = $n
$current_mat = 1; //il ne faut pas oublier la valeur d'initialisation
return; //sortie
}
for ($i = 0; $i < $n; $i++) //pour chaque dimension
//descendre encore d'un cran
create_recur_mat($current_mat[$i], $n, $current_n + 1);
}
print_r($mat);
}
?>
</body>
</html> |
Partager