Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="et">
- <head>
- <meta charset="UTF-8">
- <title>Ruutvõrrandi lahendamise programm</title>
- <style>
- body{
- margin-left: 10px;
- }
- .nr{
- width: 25px;
- border: 1px solid #000000;
- }
- </style>
- </head>
- <body>
- <h2>Ruutvõrrandi lahendamise programm</h2>
- <br><br>
- <a>
- <table>
- <tr>
- <td rowspan="2"><font size="+6">{<!-- } --></font></td>
- <td>a<sub>1</sub><i>x</i> + b<sub>1</sub><i>y</i> + c<sub>1</sub> = 0</td>
- </tr>
- <tr>
- <td>a<sub>2</sub><i>x</i> + b<sub>2</sub><i>y</i> + c<sub>2</sub> = 0</td>
- </tr>
- </table>
- </a>
- <br><br>
- <a>Sisesta lineaarvõrrandite kordajad a, b ja c! </a>
- <br><br>
- <form method="get" action="">
- <table>
- <tr>
- <td rowspan="2"><font size="+6">{<!-- } --></font></td>
- <td><input class="nr" type="number" name="a1"><i> x</i> + <input class="nr" type="number" name="b1"><i>y</i> + <input class="nr" type="number" name="c2"> = 0</td>
- </tr>
- <tr>
- <td><input class="nr" type="number" name="a2"><i> x</i> + <input class="nr" type="number" name="b2"><i>y</i> + <input class="nr" type="number" name="c2"> = 0</td>
- </tr>
- </table>
- <br><br>
- <input type="submit" value="Arvuta!">
- <br><br>
- </form>
- <?php
- if ( isset($_GET["a1"], $_GET["b1"], $_GET["c1"], $_GET["a2"], $_GET["b2"], $_GET["c2"])){
- $a1 = $_GET["a1"];
- $b1 = $_GET["b1"];
- $c1= $_GET["c1"];
- $a2 = $_GET["a2"];
- $b2 = $_GET["b2"];
- $c2 = $_GET["c2"];
- if(is_numeric($a1) && is_numeric($b1) && is_numeric($c1)&& is_numeric($a2)&& is_numeric($b2)&& is_numeric($c2) ){
- $D = $a1 * $b2 - $a2 * $b1;
- $Dx = -$c1 * $b2 - (-$c2 * $b1);
- $Dy = $a1 * (-$c2) - $a2 * (-$c1);
- if ( $D==0 ){
- echo "Lahendit ei saa arvutada";
- }elseif ($Dx==0 ){
- echo "Sirged ühtivad ning lineaarvõrrandisüsteemil on lõpmata palju lahendeid.";
- }elseif($Dy==0){
- echo "Sirged on parallelsed ning lineaarvõrrandisüsteemil lahendid puuduvad";
- }else{
- $x = $Dx / $D;
- $y = $Dy / $D;
- echo" <i>x</i> = $x, <i>y</i> = $y";
- }
- }else{
- echo"sisesta arvud v midagi";
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement