Jegor.pl

Wyświetl wszystko






main:
import java.util.*;

public class Main {
public static void main(String[] args) {

KuponTotolotka kupon = new KuponTotolotka();
Scanner sc = new Scanner(System.in);

for (int i = 0; i < 3; i++) {


kupon.liczba1 = 0;
kupon.liczba2 = 0;
kupon.liczba3 = 0;
kupon.liczba4 = 0;
kupon.liczba5 = 0;
kupon.liczba6 = 0;


System.out.println("=== Kupon nr " + (i + 1) + " ===");


int[] wpisane = new int[6];

for (int j = 0; j < 6; j++) {
boolean czy_poprawna = false;

while (!czy_poprawna) {
System.out.print("Wpisz liczbę " + (j + 1) + " (1-49): ");

if (sc.hasNextInt()) {
int liczba = sc.nextInt();

if (liczba >= 1 && liczba <= 49) {


boolean czy_duplikat = false;
for (int k = 0; k < j; k++) {
if (wpisane[k] == liczba) {
czy_duplikat = true;
break;
}
}

if (czy_duplikat) {
System.out.println("Błąd! Ta liczba została już wpisana.");
} else {

wpisane[j] = liczba;


if (j == 0) kupon.liczba1 = liczba;
else if (j == 1) kupon.liczba2 = liczba;
else if (j == 2) kupon.liczba3 = liczba;
else if (j == 3) kupon.liczba4 = liczba;
else if (j == 4) kupon.liczba5 = liczba;
else if (j == 5) kupon.liczba6 = liczba;

czy_poprawna = true;
}
} else {
System.out.println("Błąd! Liczba musi być z zakresu od 1 do 49.");
}
} else {
System.out.println("Błąd! Wpisz poprawną liczbę całkowitą.");
sc.next();
}
}
}

System.out.println("Twój kupon to:");
kupon.wypisywanie();
System.out.println();
System.out.println();
System.out.println();
System.out.println();
}

sc.close();
}
}
kupon:

public class KuponTotolotka {
int liczba1;
int liczba2;
int liczba3;
int liczba4;
int liczba5;
int liczba6;


void wypisywanie(){


System.out.println("Liczba1:" + liczba1);
System.out.println("Liczba2:" + liczba2);
System.out.println("Liczba3:" + liczba3);
System.out.println("Liczba4:" + liczba4);
System.out.println("Liczba5:" + liczba5);
System.out.println("Liczba6:" + liczba6);

}


}


Wojciech Kurek (wojtekkurek)

2026-04-16 09:43:33

// anagramy v2
#include <iostream>
#include <fstream>

using namespace std;

//bubble sort

string sort1(string w)
{
char temp;
for(int i=0;i<=w.length()-1;i++){
for(int j=0;j<w.length()-1;j++){
if(w[j]>w[j+1]){
temp = w[j];
w[j] = w[j+1];
w[j+1]=temp;
}
}
}
return w;
}

bool czyAnagram(string a, string b){
a=sort1(a);
b=sort1(b);
if(a==b){
return true;
}
else{
return false;
}

}

string duzeNaMale(string a){
string nowy="";
for(int i =0;i<a.length();i++){
if(a[i]>='A' && a[i]<='Z'){
nowy+=char(int(a[i])+32);
}
else{
nowy+=a[i];
}
}
return nowy;
}

int main(){

//pobieranie anagramów i wysłyłanie ich do pliku w odwrotnej kolejności
ifstream pobr("pary.txt");
ofstream zapis("pary2.txt");

string wyraz1;
string wyraz2;

for(int i =0; i<7;i++){
pobr >> wyraz1 >> wyraz2;
cout << wyraz1 << " " << wyraz2 << czyAnagram(wyraz1, wyraz2) << endl;
if(!czyAnagram(wyraz1, wyraz2)){
zapis << wyraz2 << " " << wyraz1 << endl;
}
}
return 0;
}

// palindromy
#include <iostream>
#include <fstream>

using namespace std;

string bezSpacji(string z){
string nowy="";
for(int i=0;i<z.length();i++){
if(z[i]!=' '){
nowy+=z[i];
}
}
return nowy;
}

string duzeNaMale(string a){

string nowy="";

for(int i =0;i<a.length();i++){
if(a[i]>='A' && a[i]<='Z'){
nowy+=char(int(a[i])+32);
}
else{
nowy+=a[i];
}
}
return nowy;
}

bool czyPalindrom(string w){

w=bezSpacji(w);
w=duzeNaMale(w);

for(int i=0,j=w.length()-1;i<j;i++,j--){
if(w[i]!=w[j]){
return false;
}
}
return true;
}
int main(){
string wyraz;

ifstream odczyt ("odczyt.txt");

for(int i =0;i<10;i++){
getline(odczyt, wyraz);
cout << duzeNaMale(wyraz) << " => " << czyPalindrom(wyraz) << endl;

}
odczyt.close();
return 0;
}

// zmienne tekstowe
#include <iostream>
#include <fstream>
using namespace std;

int main(){
/*
int suma=0;
string n;
string m;

cout << "podaj miasto: ";
getline(cin,m);
cout << "podaj nazwisko: ";
getline(cin,n);

cout << "Witaj " << n << " twoje miasto to " << m << endl;
for(int i=0;i<n.length();i++){
if(n[i]=='a'){
suma++;
}
}

cout << "ilosc liter 'a' w twoim nazwisku: " << suma;
*/

/*z pliku pobierz 5 zdan wypisz je w kazdym zdaniu zlicz ile jest liter 'e'
lub 'E' ile jest 'spacji' we wszystkich zdaniach, i kazda litere 'i' zamien na znak dolara. Zmienione zdania wyslij do pliku
*/
/*
int sumae =0;
int sumas =0;
string a;
ifstream odczyt("zdania.txt");
ofstream zapis("zdania2.txt");
for(int i=0;i<5;i++){
getline(odczyt,a);
cout << a<<endl;
for(int j=0;j<a.length();j++){
if(a[j] == 'e' || a[j] == 'E'){
sumae++;
}
if(a[j] == ' '){
sumas++;
}
if(a[j] == 'i'){
a[j]='$';
}
}

cout << "jest " << sumae << " liter 'e' lub 'E'"<<endl;
sumae=0;
zapis<<a<<endl;
}
cout << "w zdaniach jest " << sumas << " spacji"<<endl;
*/

/*pobierz zdanie od uzytkowinka i nastepnie pierwsz liter wyst puj c w zdaniu zamie na wielk
a jesli jest juz duza to niech zostanie*/

string z;

cout << "podaj zdanie"<<endl;
cin >> z <<endl;
for(int i=0;i<a.length();i++){
if(a[i] >= 'a' && a[i] <= 'z'){
//na kod ascii
a[i] = char(int (a[i])-32);
}
}
return 0;
}

// liczenie 'a' oraz zmiana 'a' na '*' kiedy parzyste
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
ifstream odczyt ("zdania.txt");
ofstream zapis ("zdania2.txt");
int k=0;
string zdanie;

for(int i=0;i<5;i++){
getline(odczyt,zdanie);

for(int j=0;j<zdanie.length();j++)
{
if(zdanie[j]=='a' || zdanie[j] == 'A')
{
k++;
}
}

if(k==2)
{
for(int j=0;j<zdanie.length();j++)
{
if(zdanie[j]=='a' || zdanie[j]=='A')
{
zdanie[j] = '*';
}
}
zapis << zdanie << endl;
}

cout << zdanie << "-->"<<k<< endl;
k=0;
}


return 0;
}


Jegor Lytvynov (admin)

2026-04-16 09:35:55

#include <iostream>
#include <fstream>
using namespace std;


int main()
{
ifstream dane("dane.txt");
string x;
for(int i=0;i<3;i++)
{

dane>>x;
cout<<x<<endl;

}

return 0;
}


Jegor Lytvynov (admin)

2026-04-16 09:31:36

string duzenamale(string w)
{
string nowy = "";
for(int i=0; i<w.length();i++)
{
if(w[i]>='A'&& w[i]<='Z')
{
nowy+=char(int(w[i])+32);
}
else{
nowy+=w[i];
}

}
return nowy;
}


Wojciech Kurek (wojtekkurek)

2026-04-16 09:29:09

// anagramy v2
#include <iostream>
#include <fstream>

using namespace std;

string sort1(string w)
{
char temp;
for(int i=0;i<=w.length()-1;i++){
for(int j=0;j<w.length()-1-i;j++){
if(w[j]>w[j+1]){
temp = w[j];
w[j] = w[j+1];
w[j+1]=temp;
}
}
}
return w;
}

bool czyAnagram(string a, string b){
a=sort1(a);
b=sort1(b);
if(a==b){
return true;
}
else{
return false;
}

}

string duzeNaMale(string a){
string nowy="";
for(int i =0;i<a.length();i++){
if(a[i]>='A' && a[i]<='Z'){
nowy+=char(int(a[i])+32);
}
else{
nowy+=a[i];
}
}
return nowy;
}

int main(){
ifstream pobr("pary.txt");
ofstream zapis("pary2.txt");

string wyraz1;
string wyraz2;

for(int i =0; i<7;i++){
pobr >> wyraz1 >> wyraz2;
cout << wyraz1 << " " << wyraz2 << czyAnagram(wyraz1, wyraz2) << endl;
if(!czyAnagram(wyraz1, wyraz2)){
zapis << wyraz2 << " " << wyraz1 << endl;
}
}
return 0;
}

// palindromy
#include <iostream>
#include <fstream>

using namespace std;

string bezSpacji(string z){
string nowy="";
for(int i=0;i<z.length();i++){
if(z[i]!=' '){
nowy+=z[i];
}
}
return nowy;
}

string duzeNaMale(string a){

string nowy="";

for(int i =0;i<a.length();i++){
if(a[i]>='A' && a[i]<='Z'){
nowy+=char(int(a[i])+32);
}
else{
nowy+=a[i];
}
}
return nowy;
}

bool czyPalindrom(string w){

w=bezSpacji(w);
w=duzeNaMale(w);

for(int i=0,j=w.length()-1;i<j;i++,j--){
if(w[i]!=w[j]){
return false;
}
}
return true;
}
int main(){
string wyraz;

ifstream odczyt ("odczyt.txt");

for(int i =0;i<10;i++){
getline(odczyt, wyraz);
cout << duzeNaMale(wyraz) << " => " << czyPalindrom(wyraz) << endl;

}
odczyt.close();
return 0;
}

// zmienne tekstowe
#include <iostream>
#include <fstream>
using namespace std;

int main(){
/*
int suma=0;
string n;
string m;

cout << "podaj miasto: ";
getline(cin,m);
cout << "podaj nazwisko: ";
getline(cin,n);

cout << "Witaj " << n << " twoje miasto to " << m << endl;
for(int i=0;i<n.length();i++){
if(n[i]=='a'){
suma++;
}
}

cout << "ilosc liter 'a' w twoim nazwisku: " << suma;
*/

/*z pliku pobierz 5 zdan wypisz je w kazdym zdaniu zlicz ile jest liter 'e'
lub 'E' ile jest 'spacji' we wszystkich zdaniach, i kazda litere 'i' zamien na znak dolara. Zmienione zdania wyslij do pliku
*/
/*
int sumae =0;
int sumas =0;
string a;
ifstream odczyt("zdania.txt");
ofstream zapis("zdania2.txt");
for(int i=0;i<5;i++){
getline(odczyt,a);
cout << a<<endl;
for(int j=0;j<a.length();j++){
if(a[j] == 'e' || a[j] == 'E'){
sumae++;
}
if(a[j] == ' '){
sumas++;
}
if(a[j] == 'i'){
a[j]='$';
}
}

cout << "jest " << sumae << " liter 'e' lub 'E'"<<endl;
sumae=0;
zapis<<a<<endl;
}
cout << "w zdaniach jest " << sumas << " spacji"<<endl;
*/

/*pobierz zdanie od uzytkowinka i nastepnie pierwsz liter wyst puj c w zdaniu zamie na wielk
a jesli jest juz duza to niech zostanie*/

string z;

cout << "podaj zdanie"<<endl;
cin >> z <<endl;
for(int i=0;i<a.length();i++){
if(a[i] >= 'a' && a[i] <= 'z'){
//na kod ascii
a[i] = char(int (a[i])-32);
}
}
return 0;
}

// liczenie 'a' oraz zmiana 'a' na '*' kiedy parzyste
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
ifstream odczyt ("zdania.txt");
ofstream zapis ("zdania2.txt");
int k=0;
string zdanie;

for(int i=0;i<5;i++){
getline(odczyt,zdanie);

for(int j=0;j<zdanie.length();j++)
{
if(zdanie[j]=='a' || zdanie[j] == 'A')
{
k++;
}
}

if(k==2)
{
for(int j=0;j<zdanie.length();j++)
{
if(zdanie[j]=='a' || zdanie[j]=='A')
{
zdanie[j] = '*';
}
}
zapis << zdanie << endl;
}

cout << zdanie << "-->"<<k<< endl;
k=0;
}


return 0;
}



Jegor Lytvynov (admin)

2026-04-16 09:27:06

#include <iostream>

using namespace std;

bool czypalindrom(string a)
{
for(int i=0, j=a.length()-1;i<j;i++,j--)
{
if(a[i]!=a[j])
return false;
}
return true;
}

string sortuj(string a)
{
for(int i =0; i<a.length()-1;i++)
{
for(int j =0; j<a.length()-1-i; j++)
{
char temp;
if(a[j]>a[j+1])
{
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;

}

}


}
return a;

}

bool czyanagram(string a, string b)
{
if(sortuj(a)==sortuj(b)){
return true;
}
else{
return false;
}
}
int main()
{

cout<<czyanagram("kajak","kkaaj");
return 0;
}


Jegor Lytvynov (admin)

2026-04-15 14:04:56

<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="root"></div>
<script>
let rut = document.getElementById('root')
let pe = document.createElement("p")
pe.innerText = "Trampki"
pe.classList.add("pee")
rut.append(pe)

let ul = document.createElement("ul")
rut.appendChild(ul)

for(let i=1;i<=10;i++)
{
let eli=document.createElement("li")
eli.innerText = `Lista nr (${i})`
ul.append(eli)
}

let imageKun = document.createElement("img")
imageKun.src = "https://jegor.pl/zdjecia/152988zdjecie.png"
imageKun.classList.add("kun")
rut.appendChild(imageKun)

</script>
</body>
</html>



Wojciech Kurek (wojtekkurek)

2026-04-14 12:01:00

masz kasti admin.php:

<?php
if(session_status() == PHP_SESSION_NONE){session_start();}
$_SESSION['dostep'] = 1;
if($_SESSION['dostep'] != 1)
{
header("location:index.php?strona=login");

}


?>

<div class="card">
<div class="card-header">
Panel admina
</div>
<div class="card-body">
<h5 class="card-title">Pulpit</h5>
<p class="card-text">Dzień dobry

<?php

if(isset($_GET['karta']) && ($_GET['karta']== 'ustawienia'))
{
include('ustawienia.php');
}


if(isset($_GET['karta']) && ($_GET['karta']== 'rejsy'))
{
include('rejsy.php');
}





?>

</div>

</div>
<?php

if((isset($_GET['zapisz_ustawienia']) && ($_GET['zapisz_ustawienia'])== "Zapisz"))
{
$sql="UPDATE `ustawienia` SET `nazwa` = '".$_GET['nazwa']."' WHERE `ustawienia`.`id`=1;";
$zapytanie = mysqli_query($conn,$sql);
header('location: index.php?strona=admin&karta=ustawienia');
}

?>


Wojciech Kurek (wojtekkurek)

2026-04-14 12:00:39

masz;
<?php
$sql="select * from `ustawienia` where id=1";
$zapytanie=mysqli_query($conn,$sql);
$wynik = mysqli_fetch_array($zapytanie);
$ustawienia = $wynik[1];


?>

<form action="index.php" method="GET">
<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Nazwa strony</label>
<input type="text" value="<?php echo $ustawienia?>" name="nazwa" class="form-control" id="exampleFormControlInput1"/>

</div>
<div class="mb-3">
<input type="submit" class="btn btn-primary" name="zapisz_ustawienia" class="form-control" value="Zapisz"/>
<input type="hidden" name="strona" value="admin"/>
<input type="hidden" name="karta" value="ustawienia"/>
</div>
</form>




Wojciech Kurek (wojtekkurek)

2026-04-14 10:47:51

macie cwele:

<?php
if(session_status() == PHP_SESSION_NONE){session_start();}
$_SESSION['dostep'] = 1;
if($_SESSION['dostep'] != 1)
{
header("location:index.php?strona=login");

}


?>

<div class="card">
<div class="card-header">
Panel admina
</div>
<div class="card-body">
<h5 class="card-title">Pulpit</h5>
<p class="card-text">Dzień dobry

<?php
$sql="select * from `ustawienia` where id=1";
$zapytanie=mysqli_query($conn,$sql);
$wynik = mysqli_fetch_array($zapytanie);
$ustawienia = $wynik[1];


?>

<form action="index.php" method="GET">
<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Nazwa strony</label>
<input type="text" value="<?php echo $ustawienia?>" name="nazwa" class="form-control" id="exampleFormControlInput1"/>

</div>
<div class="mb-3">
<input type="submit" class="btn btn-primary" name="zapisz_ustawienia" class="form-control" value="Zapisz"/>
<input type="hidden" name="strona" value="admin"/>
<input type="hidden" name="karta" value="ustawienia"/>
</div>
</form>
</p>
</div>

</div>

<?php

if((isset($_GET['zapisz_ustawienia']) && ($_GET['zapisz_ustawienia'])== "Zapisz"))
{
$sql="UPDATE `ustawienia` SET `nazwa` = '".$_GET['nazwa']."' WHERE `ustawienia`.`id`=1;";
$zapytanie = mysqli_query($conn,$sql);
header('location: index.php?strona=admin&karta=ustawienia');
}

?>


Jegor Lytvynov (admin)

2026-04-14 10:28:17

<?php
if(session_status() == PHP_SESSION_NONE) {session_start();}
$_SESSION['dostep'] = 1;
if($_SESSION['dostep'] != 1)
{
header("location:index.php?strona=login");
}

?>
<div class="card">
<div class="card-header">
Panel Admina
</div>
<div class="card-body">
<h5 class="card-title"></h5>
<p class="card-text">

<?php
$sql = "select * from ustawienia where id = 1";
$zapytanie=mysqli_query($conn,$sql);
$wynik = mysqli_fetch_array($zapytanie);
$ustawienia = $wynik[1];
?>
<form action="index.php" method="get">

<div class="mb-3">
<label for="exampleFormControlInput1" class="form-label">Nazwa strony</label>
<input type="text" value="<?php echo $ustawienia?>" name="nazwa" class="form-control" id="xampleFormControlInput1">
</div>
<div class="mb-3">
<input type="submit" class="btn btn-primary" name="zapisz_ustawienia" class="form-control" value="Zapisz">
<input type="hidden" name="strona" value="admin">
<input type="hidden" name="karta" value="ustawienia">
</div>
</form>
</p>
</div>
</div>
<?php

if((isset($_GET['zapisz_ustawienia']) && ($_GET['zapisz_ustawienia']) == "Zapisz"))
{
$sql = "update ustawienia set nazwa = '".$_GET['nazwa']."' where id = 1";
$zapytanie = mysqli_query($conn, $sql);
header("location: index.php?strona=admin&karta=ustawienia");

}
?>



Załaduj więcej