note 100949 deleted from language.functions by thiago
| From: | thiago@php.net | Date: | Tue, 16 Nov 2010 19:36:43 +0000 |
| Subject: | note 100949 deleted from language.functions by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174098@lists.php.net to get a copy of this message | ||
Note Submitter: nassim rehali
----
This function calculates the delta of the quadratic equation, which gives you the solutions and the
solutions were not there you will print it
and these is the class coded by me : the algerian nassim rehali
<?
class delta_class {
public $a = '1';
public $b = '4';
public $c = '1';
function alger(){
// calculate delta
$bb = $this->b * $this->b;
$ab = 4*$this->a*$this->c;
// apercevoir delta
echo delta is : ";
echo $delta = $bb-$ab."<br>";
if($delta > 0){
// la racine de delta
$racine_delta = sqrt($delta);
// les deux solution
$x1 = -$this->b - $racine_delta / 2 * $this->a;
$x2 = -$this->b + $racine_delta / 2 * $this->a;
echo "the first solution is : ";
echo $x1;
echo "<br>";
echo "the second solution is: ";
echo $x2;
exit();
}elseif($delta == 0){
// la seule solution
$x3 = - $this->b / 2 * $this->a;
echo "the is only one solution :";
echo $x3;
return $x3;
}elseif($delta < 0){
// apercevoir qu'il existe pas de solution
echo"don't exist solution ";
exit();
}
}
}
?>