Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <form method="post">
- x<sub>1</sub> <input name="x1" />y<sub>1</sub> <input name="y1" /></br>
- x<sub>2</sub> <input name="x2" />y<sub>2</sub> <input name="y2" /></br>
- x<sub>3</sub> <input name="x3" />y<sub>3</sub> <input name="y3" /></br>
- <input type="submit" value="Rozwiąż pole trójkąta" />
- </form>
- <?php
- $x1 = @$_POST['x1'];
- $x2 = @$_POST['x2'];
- $x3 = @$_POST['x3'];
- $y1 = @$_POST['y1'];
- $y2 = @$_POST['y2'];
- $y3 = @$_POST['y3'];
- $pole=abs(($x2-$x1)*($y3-$y1)-($y2-$y1)*($x3-$x1))/2;
- if($x1==null || $x2==null || $x3==null || $y1==null || $y2==null || $y3==null || $pole==0 ) {echo "Wprowadź poprawne dane";}
- else{
- $x1 = @$_POST['x1'];
- $x2 = @$_POST['x2'];
- $x3 = @$_POST['x3'];
- $y1 = @$_POST['y1'];
- $y2 = @$_POST['y2'];
- $y3 = @$_POST['y3'];
- echo "A=($x1,$y1) B=($x2,$y2) C=($x3,$y3)<br>";
- $pole=abs(($x2-$x1)*($y3-$y1)-($y2-$y1)*($x3-$x1))/2;
- echo "Pole trójkąta o tych współrzędnych wynosi $pole";
- //$AB=sqrt(pow($x2-$x1,2)-pow($y2-$y1,2));
- //$AC=sqrt(pow($x3-$x2,2)-pow($y3-$y2,2));
- //$BC=sqrt(pow($x3-$x1,2)-pow($y3-$y1,2));
- //echo "<br>Długość AB= $AB <br> Długość AC= $AC <br> Długość BC= $BC";
- //$x1==$x2 || $x1==$x3 || $x2==$x3 || $y1==$y2 || $y1==$y3 || $y2==$y3 ||
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement