kuniec
This commit is contained in:
parent
eee0a5263e
commit
2bafad77a0
26
cpp/ciag_liczb_rzeczywistych/main.cpp
Normal file
26
cpp/ciag_liczb_rzeczywistych/main.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
//napusz program wyczytujący ciąg liczb rzeczywistych. Wydrukuj na ekranie tespośród liczb, których indeks jest liczbą parzystą
|
||||
double tablica[] = {55,28,23,21,56,87,15,34,78,12,69,99,45,32,85,27,53,71};
|
||||
int i,n;
|
||||
|
||||
n = sizeof(tablica)/sizeof(tablica[0]);
|
||||
|
||||
cout << "Ciag liczb: ";
|
||||
for(i=0; i<n; i++) {
|
||||
cout << tablica[i] << " ";
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
for(i=0; i<n; i++) {
|
||||
if(i%2 == 0) {
|
||||
cout << "Liczba parzysta z indeksem " << i << ": " << tablica[i] << endl;
|
||||
}
|
||||
}
|
||||
|
||||
system("pause");
|
||||
return 0;
|
||||
|
||||
}
|
24
cpp/ciag_liczb_rzeczywistych/main2.cpp
Normal file
24
cpp/ciag_liczb_rzeczywistych/main2.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
//napusz program wyczytujący ciąg liczb rzeczywistych. Wydrukuj na ekranie tespośród liczb, których indeks jest liczbą parzystą
|
||||
double tablica[] = {55,28,23,21,56,87,15,34,78,12,69,99,45,32,85,27,53,71};
|
||||
int i,n;
|
||||
|
||||
n = sizeof(tablica)/sizeof(tablica[0]);
|
||||
|
||||
cout << "Ciag liczb: ";
|
||||
for(i=0; i<n; i++) {
|
||||
cout << tablica[i] << " ";
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
for(i=1; i<=4; i++) {
|
||||
cout << "Liczba parzysta z indeksem " << i << ": " << tablica[i] << endl;
|
||||
}
|
||||
|
||||
system("pause");
|
||||
return 0;
|
||||
|
||||
}
|
31
cpp/ciag_liczb_rzeczywistych/main3.cpp
Normal file
31
cpp/ciag_liczb_rzeczywistych/main3.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include <iostream>
|
||||
#include <conio.h>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int n,i,k;
|
||||
|
||||
cout << "N = ";
|
||||
cin >> n;
|
||||
int *a = new int[n];
|
||||
cout << "K = ";
|
||||
cin >> k;
|
||||
|
||||
int j = 0;
|
||||
for(i = k * 2;i<=n; i++) {
|
||||
if(i%k == 0) {
|
||||
a[j] = i;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i<j; i++) {
|
||||
cout << a[i] << " ";
|
||||
}
|
||||
|
||||
delete [] a;
|
||||
|
||||
system("pause");
|
||||
getch();
|
||||
return 0;
|
||||
}
|
35
cpp/ciag_liczb_rzeczywistych/main4.cpp
Normal file
35
cpp/ciag_liczb_rzeczywistych/main4.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include <iostream>
|
||||
#include <conio.h>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int n,i,k;
|
||||
|
||||
cout << "N = ";
|
||||
cin >> n;
|
||||
int *a = new int[n];
|
||||
cout << "K = ";
|
||||
cin >> k;
|
||||
|
||||
int j = 0;
|
||||
i = k*2;
|
||||
while (i<=n){
|
||||
i++;
|
||||
if(i%k == 0) {
|
||||
a[j] = i;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while(i<j) {
|
||||
cout << a[i] << " ";
|
||||
i++;
|
||||
}
|
||||
|
||||
delete [] a;
|
||||
|
||||
system("pause");
|
||||
getch();
|
||||
return 0;
|
||||
}
|
23
cpp/ciag_liczb_rzeczywistych/main5.cpp
Normal file
23
cpp/ciag_liczb_rzeczywistych/main5.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include <iostream>
|
||||
#include <conio.h>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int n,i,k;
|
||||
|
||||
cout << "N = ";
|
||||
cin >> n;
|
||||
int *a = new int[n];
|
||||
cout << "K = ";
|
||||
cin >> k;
|
||||
|
||||
for(i=k*2; i<=n; i=i+k) {
|
||||
cout << i << " ";
|
||||
}
|
||||
|
||||
delete [] a;
|
||||
|
||||
system("pause");
|
||||
getch();
|
||||
return 0;
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
#figura {
|
||||
width: fit-content;
|
||||
margin-left:auto;
|
||||
margin-right: auto;
|
||||
margin-top: 3%;
|
||||
}
|
||||
#figura input {
|
||||
width: 200px;
|
||||
font-size: 140%;
|
||||
height: 50px;
|
||||
font-weight: bold;
|
||||
border-radius: 20px;
|
||||
}
|
||||
.wynik {
|
||||
float: left;
|
||||
font-size: 150%;
|
||||
color:navy;
|
||||
margin: 40px 50px;
|
||||
font-weight: bold;
|
||||
}
|
||||
fieldset {
|
||||
margin-top:8%;
|
||||
margin-left:10%;
|
||||
width: fit-content;
|
||||
padding: 20px 60px;
|
||||
line-height: 2em;
|
||||
font-size:200%;
|
||||
background: linear-gradient(to left,red,gold);
|
||||
}
|
||||
fieldset input {
|
||||
width: 4em;
|
||||
}
|
||||
legend {
|
||||
font-weight: bold;
|
||||
}
|
||||
fieldset input[type="submit"] {
|
||||
width: 6em;
|
||||
font-size: 0.6em;
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<link rel="stylesheet" href="brala.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="figura">
|
||||
<table>
|
||||
<tr>
|
||||
<th><img src="./walec.jpg" alt="walec" title="walec"></th>
|
||||
<th><img src="./stozek.jpg" alt="stożek" title="stożek"></th>
|
||||
<th><img src="./graniastoslup.jpg" alt="granistosłup" title="granistosłup"></th>
|
||||
<th><img src="./ostroslup.jpg" alt="ostrosłup" title="ostrosłup"></th>
|
||||
</tr>
|
||||
<form action="oblicz.php" method="post">
|
||||
<tr>
|
||||
<th><input type="submit" value="walec" name="walec"></th>
|
||||
<th><input type="submit" value="stożek" name="stozek"></th>
|
||||
<th><input type="submit" value="graniastosłup" name="graniastoslup"></th>
|
||||
<th><input type="submit" value="ostrosłup" name="ostroslup"></th>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
</div>
|
||||
<div id="wynik">
|
||||
|
||||
<?php
|
||||
echo "<div class='wynik'>";
|
||||
if(isSet($_COOKIE['poleW'])) {
|
||||
echo "H = ",$_COOKIE['hw'],"<br>";
|
||||
echo "r = ",$_COOKIE['rw'],"<br>";
|
||||
echo "pole walca = ",number_format($_COOKIE['poleW'],3),"<br>";
|
||||
echo "objętość walca = ",number_format($_COOKIE['obW'],3),"<br>";
|
||||
//setcookie("poleW","",time()-50,"/");
|
||||
}
|
||||
echo "</div>";
|
||||
echo "<div class='wynik'>";
|
||||
if(isSet($_COOKIE['poleS'])) {
|
||||
echo "H = ",$_COOKIE['hs'],"<br>";
|
||||
echo "r = ",$_COOKIE['rs'],"<br>";
|
||||
echo "l = ",$_COOKIE['ls'],"<br>";
|
||||
echo "pole stożka = ",number_format($_COOKIE['poleS'],3),"<br>";
|
||||
echo "objętość stożka = ",number_format($_COOKIE['obS'],3),"<br>";
|
||||
//setcookie("poleS","",time()-60,"/");
|
||||
}
|
||||
echo "</div>";
|
||||
echo "<div class='wynik'>";
|
||||
if(isSet($_COOKIE['poleG'])) {
|
||||
echo "H = ",$_COOKIE['hg'],"<br>";
|
||||
echo "a = ",$_COOKIE['ag'],"<br>";
|
||||
echo "pole graniastosłupa = ",number_format($_COOKIE['poleG'],3),"<br>";
|
||||
echo "objętość graniastosłupa = ",number_format($_COOKIE['obG'],3),"<br>";
|
||||
}
|
||||
echo "</div>";
|
||||
echo "<div class='wynik'>";
|
||||
if(isSet($_COOKIE['poleO'])) {
|
||||
echo "H = ",$_COOKIE['ho'],"<br>";
|
||||
echo "a = ",$_COOKIE['ao'],"<br>";
|
||||
echo "pole ostrosłupa = ",number_format($_COOKIE['poleO'],3),"<br>";
|
||||
echo "objętość ostrosłupa = ",number_format($_COOKIE['obO'],3),"<br>";
|
||||
}
|
||||
echo "</div>";
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,101 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<link rel="stylesheet" href="brala.css">
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
if(isSet($_POST['walec'])) {
|
||||
echo "<form method='post'>
|
||||
<fieldset>
|
||||
<legend>dane do walca</legend>
|
||||
wysokość H = <input type='text' name='h'><br>
|
||||
promień r = <input type='text' name='r'><br>
|
||||
<input type='submit' value='oblicz' name='walec'>
|
||||
</fieldset>
|
||||
</form>";
|
||||
}
|
||||
if(isSet($_POST['w'])) {
|
||||
$h = $_POST['h'];
|
||||
$r = $_POST['r'];
|
||||
$poleW = 2*M_PI*$r*$r+2*M_PI*$r*$h;
|
||||
$obW = M_PI*$r*$r*$h;
|
||||
setcookie("poleW",$poleW,time()+60,"/");
|
||||
setcookie("obW",$obW,time()+60,"/");
|
||||
setcookie("hw",$h,time()+60,"/");
|
||||
setcookie("rw",$r,time()+60,"/");
|
||||
header("Location: brala.php");
|
||||
}
|
||||
|
||||
if(isSet($_POST['stozek'])) {
|
||||
echo "<form method='post'>
|
||||
<fieldset>
|
||||
<legend>dane do stożka</legend>
|
||||
wysokość H = <input type='text' name='h'><br>
|
||||
promień r = <input type='text' name='r'><br>
|
||||
bok l = <input type='text' name='l'><br>
|
||||
<input type='submit' value='oblicz' name='s'>
|
||||
</fieldset>
|
||||
</form>";
|
||||
}
|
||||
if(isSet($_POST['s'])) {
|
||||
$h = $_POST['h'];
|
||||
$r = $_POST['r'];
|
||||
$l = $_POST['l'];
|
||||
$poleS = M_PI*$r*$r+M_PI*$r*$l;
|
||||
$obS = 1/3*M_PI*$r*$r*$h;
|
||||
setcookie("poleS",$poleS,time()+60,"/");
|
||||
setcookie("obS",$obS,time()+60,"/");
|
||||
setcookie("hs",$h,time()+60,"/");
|
||||
setcookie("rs",$r,time()+60,"/");
|
||||
setcookie("ls",$r,time()+60,"/");
|
||||
header("Location: brala.php");
|
||||
}
|
||||
if(isSet($_POST['graniastoslup'])) {
|
||||
echo "<form method='post'>
|
||||
<fieldset>
|
||||
<legend>dane do graniastosłupa</legend>
|
||||
wysokość H = <input type='text' name='h'><br>
|
||||
bok a = <input type='text' name='a'><br>
|
||||
<input type='submit' value='oblicz' name='g'>
|
||||
</fieldset>
|
||||
</form>";
|
||||
}
|
||||
if(isSet($_POST['g'])) {
|
||||
$h = $_POST['h'];
|
||||
$a = $_POST['a'];
|
||||
$poleG = 2*$a*$a+4*$a*$h;
|
||||
$obG = $a*$a*$h;
|
||||
setcookie("poleG",$poleG,time()+60,"/");
|
||||
setcookie("obG",$obG,time()+60,"/");
|
||||
setcookie("hg",$h,time()+60,"/");
|
||||
setcookie("ag",$a,time()+60,"/");
|
||||
header("Location: brala.php");
|
||||
}
|
||||
if(isSet($_POST['ostroslup'])) {
|
||||
echo "<form method='post'>
|
||||
<fieldset>
|
||||
<legend>dane do ostrosłupa</legend>
|
||||
wysokość H = <input type='text' name='h'><br>
|
||||
bok a = <input type='text' name='a'><br>
|
||||
<input type='submit' value='oblicz' name='o'>
|
||||
</fieldset>
|
||||
</form>";
|
||||
}
|
||||
if(isSet($_POST['o'])) {
|
||||
$h = $_POST['h'];
|
||||
$a = $_POST['a'];
|
||||
$poleO = $a*$a+2*$a*$a*$h;
|
||||
$obO = 1/3*$a*$a*$h;
|
||||
setcookie("poleO",$poleO,time()+60,"/");
|
||||
setcookie("obO",$obO,time()+60,"/");
|
||||
setcookie("ho",$h,time()+60,"/");
|
||||
setcookie("ao",$a,time()+60,"/");
|
||||
header("Location: brala.php");
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user