21.05
This commit is contained in:
54
Zadania/Z31 - Pole z wierzchołków/index.php
Normal file
54
Zadania/Z31 - Pole z wierzchołków/index.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<!doctype html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Z31 - Pole z wierzchołków</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>Zadanie Z31</h1>
|
||||
<h2>Autor: Jakub Grzegorczyk</h2>
|
||||
</header>
|
||||
<div class="box">
|
||||
Napisz program, który: dla współrzędnych wierzchołka trójkąta (x1,y1), (x2,y2),(x3,y3), oblicza jego pole powierzchni
|
||||
<img src="img.png" alt="Wzór">
|
||||
</div>
|
||||
<div class="box">
|
||||
<form action="index.php" method="post">
|
||||
<label for="x1">Podaj x<sub>1</sub>: </label><br>
|
||||
<input type="number" name="x1" id="x1"><br><br>
|
||||
<label for="y1">Podaj y<sub>1</sub>: </label><br>
|
||||
<input type="number" name="y1" id="y1"><br><br>
|
||||
<label for="x2">Podaj x<sub>2</sub>: </label><br>
|
||||
<input type="number" name="x2" id="x2"><br><br>
|
||||
<label for="y2">Podaj y<sub>2</sub>: </label><br>
|
||||
<input type="number" name="y2" id="y2"><br><br>
|
||||
<label for="x3">Podaj x<sub>3</sub>: </label><br>
|
||||
<input type="number" name="x3" id="x3"><br><br>
|
||||
<label for="y3">Podaj y<sub>3</sub>: </label><br>
|
||||
<input type="number" name="y3" id="y3"><br><br>
|
||||
<button type="submit">Oblicz</button>
|
||||
<br>
|
||||
</form>
|
||||
</div>
|
||||
<div class="box">
|
||||
<?php
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$x1 = (float)htmlspecialchars($_POST['x1']);
|
||||
$y1 = (float)htmlspecialchars($_POST['y1']);
|
||||
$x2 = (float)htmlspecialchars($_POST['x2']);
|
||||
$y2 = (float)htmlspecialchars($_POST['y2']);
|
||||
$x3 = (float)htmlspecialchars($_POST['x3']);
|
||||
$y3 = (float)htmlspecialchars($_POST['y3']);
|
||||
|
||||
$pole = abs(($x1 * ($y2 - $y3) + $x2 * ($y3 - $y1) + $x3 * ($y1 - $y2)) / 2);
|
||||
echo "Pole powierzchni trójkąta wynosi: " . round($pole, 2);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
51
Zadania/Z31 - Pole z wierzchołków/style.css
Normal file
51
Zadania/Z31 - Pole z wierzchołków/style.css
Normal file
@@ -0,0 +1,51 @@
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
font-family: Verdana, serif;
|
||||
background: #ffffff;
|
||||
margin: 30px;
|
||||
}
|
||||
header {
|
||||
border: 2px solid black;
|
||||
border-radius: 1em;
|
||||
padding: 20px;
|
||||
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
div {
|
||||
border: 2px solid black;
|
||||
padding: 20px;
|
||||
border-radius: 1em;
|
||||
margin: 10px 0 10px 0;
|
||||
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
|
||||
}
|
||||
input {
|
||||
margin-top: 10px;
|
||||
width: 30%;
|
||||
border: black 2px solid;
|
||||
border-radius: 0.5em;
|
||||
height: 2em;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 5px;
|
||||
width: 30%;
|
||||
border: black 2px solid;
|
||||
border-radius: 0.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
pre {
|
||||
font-family: Verdana, serif;
|
||||
}
|
||||
|
||||
.box p {
|
||||
padding: 10px 15px 20px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.box h3 {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user