29.05
This commit is contained in:
67
Pracownia/P51c - Funkcja działająca na tablicach/index.php
Normal file
67
Pracownia/P51c - Funkcja działająca na tablicach/index.php
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<!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>Zadanie P51c - Funkcja działająca na tablicach</title>
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<h1>Zadanie P51-c</h1>
|
||||||
|
<h2>Autor: Jakub Grzegorczyk</h2>
|
||||||
|
</header>
|
||||||
|
<div class="box">
|
||||||
|
<?php
|
||||||
|
$tab = array(
|
||||||
|
array(1,7,3,0,1),
|
||||||
|
array(1,0,5,7,4),
|
||||||
|
array(1,5,3,2,0),
|
||||||
|
array(0,1,2,3,4),
|
||||||
|
array(1,2,3,4,5)
|
||||||
|
);
|
||||||
|
$m = 3;
|
||||||
|
function dzialanieNaTablicy($tab, $m) {
|
||||||
|
echo "<table>";
|
||||||
|
for ($i = 0; $i < count($tab); $i++) {
|
||||||
|
echo "<tr>";
|
||||||
|
for ($j = 0; $j < count($tab[$i]); $j++) {
|
||||||
|
if ($tab[$i][$j] > $m) {
|
||||||
|
echo "<td>" . $tab[$i][$j] . "</td>";
|
||||||
|
} else {
|
||||||
|
echo "<td>" . $tab[$i][$j] . "</td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
echo "</table>";
|
||||||
|
for ($i = 0; $i < count($tab); $i++) {
|
||||||
|
for ($j = 0; $j < count($tab[$i]); $j++) {
|
||||||
|
$tab[$i][$j] *= $m;
|
||||||
|
if ($tab[$i][$j] == 0) {
|
||||||
|
$tab[$i][$j] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "<hr>";
|
||||||
|
echo "<table>";
|
||||||
|
for ($i = 0; $i < count($tab); $i++) {
|
||||||
|
echo "<tr>";
|
||||||
|
for ($j = 0; $j < count($tab[$i]); $j++) {
|
||||||
|
if ($tab[$i][$j] > $m) {
|
||||||
|
echo "<td>" . $tab[$i][$j] . "</td>";
|
||||||
|
} else {
|
||||||
|
echo "<td>" . $tab[$i][$j] . "</td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
echo "</table>";
|
||||||
|
}
|
||||||
|
dzialanieNaTablicy($tab, $m);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
68
Pracownia/P51c - Funkcja działająca na tablicach/style.css
Normal file
68
Pracownia/P51c - Funkcja działająca na tablicach/style.css
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
font-family: Verdana, serif;
|
||||||
|
background: #ffffff;
|
||||||
|
margin: 15px;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
header {
|
||||||
|
border: 2px solid black;
|
||||||
|
border-radius: 1em;
|
||||||
|
padding: 10px 20px;
|
||||||
|
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
|
||||||
|
background: #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
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;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
font-family: Verdana, serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box {
|
||||||
|
border: 2px solid black;
|
||||||
|
padding: 15px 20px;
|
||||||
|
border-radius: 1em;
|
||||||
|
margin: 15px 0 10px 0;
|
||||||
|
box-shadow: rgba(0, 0, 0, 0.2) 3px 3px 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box h3 {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
td {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
tr {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.y {
|
||||||
|
background: yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
.b {
|
||||||
|
background:blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user