-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/Lekce04.BreakoutRoom1.While/Lekce04.BreakoutRoom1.While.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
// Vytvorte cyklus, ktery se uzivatele bude ptat na jeho rok narozeni | ||
// tak dlouho, dokud uzivatel nezada spravne rok narozeni | ||
// kdyz zada spravne cislo, vypocitejte a vypiste jeho vek | ||
*/ | ||
|
||
Console.WriteLine("Zadej rok narození: "); | ||
string vstupUzivateleText = Console.ReadLine(); | ||
int rokNarozeniUzivatele; | ||
bool povedloSePrevest = int.TryParse(vstupUzivateleText, out rokNarozeniUzivatele); | ||
|
||
while (!povedloSePrevest) // DOKUD se nepovedlo prevest, povedloSePrevest == false | ||
{ | ||
// donut uzivatele zadat vek znovu. | ||
Console.WriteLine("Nespravne zadané číslo. Zadej rok narození: "); | ||
vstupUzivateleText = Console.ReadLine(); | ||
povedloSePrevest = int.TryParse(vstupUzivateleText, out rokNarozeniUzivatele); | ||
} | ||
|
||
int vekUzivatele = 2025 - rokNarozeniUzivatele; | ||
Console.WriteLine($"Je ti {vekUzivatele} let."); |
10 changes: 10 additions & 0 deletions
10
src/Lekce04.BreakoutRoom2.For/Lekce04.BreakoutRoom2.For.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
Trenink na FOR cykly | ||
Vytvořte cyklus, ktery vypise poporade vsechna cisla od 0 do 20 | ||
Modifikujte cyklus tak, aby vypsal pouze suda cisla (vyuzij k vyberu pouze sudych cisel iteracni promennou), | ||
použij operátor modulo (zbytek po dělení) i % 2 == 0 | ||
bool jeCisloDelitelneDvemiBezeZbytku = (i % 2 == 0); | ||
Volitelne si od uzivatele vyzadejte pocatecni a koncova cisla, aby mohl vypsat napr. vsechna suda cisla od 100 od 200 | ||
BONUS: Ptejte se uzivatele na cislo do te doby, dokud ho nezada spravne :-) (TryParse) | ||
*/ | ||
|
||
int pocetecniCislo = 50; | ||
int koncoveCislo = 70; | ||
|
||
int zbytekPoDeleniTremi = 7 % 3; | ||
Console.WriteLine("Zbytek po deleni tremi je: " + zbytekPoDeleniTremi); | ||
|
||
for (/*iteracni promenna*/ int i = pocetecniCislo; /*podminka, pokud je splnena, cyklus se provadi dale*/ i <= koncoveCislo; /*kod vykonany po kazdem cyklu*/ i++) | ||
{ | ||
bool jeSude = i % 2 == 0; | ||
bool jeLiche = i % 2 != 0; | ||
bool jeDelitelnePeti = i % 5 == 0; | ||
if (jeSude) | ||
{ | ||
Console.WriteLine(i); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// bool jeVMisceChips = true; | ||
// if (jeVMisceChips) //ekvivalentni zapis je jeVMisceChips == true | ||
// { | ||
// Console.WriteLine("Jim chips, mnam."); | ||
// } | ||
// jeVMisceChips = true; | ||
// jeVMisceChips = false; | ||
|
||
// jeVMisceChips = true; | ||
// while (jeVMisceChips) // DOKUD je v misce chips, zde se program zacyklí | ||
// { | ||
// Console.WriteLine("Jim chips, mnam."); | ||
// } | ||
|
||
/* | ||
int pocetChipsuVMisce = 3; | ||
int pocetSnezenychChipsu = 0; | ||
while (pocetChipsuVMisce > 0) | ||
{ | ||
Console.WriteLine("Jim chips, mnam."); | ||
//pocetSnezenychChipsu = pocetSnezenychChipsu + 1; | ||
pocetSnezenychChipsu++; //ekvivalentni zapis | ||
Console.WriteLine("Snedl jsem uz " + pocetSnezenychChipsu + " chipsu"); | ||
Console.WriteLine($"Snedl jsem uz {pocetSnezenychChipsu} chipsu"); | ||
//pocetChipsuVMisce = pocetChipsuVMisce - 1; | ||
pocetChipsuVMisce--; //ekvivalentni zapis | ||
} | ||
*/ | ||
|
||
int cislo = 1; | ||
while (cislo <= 4) | ||
{ | ||
Console.WriteLine("Ahoj."); | ||
cislo++; //1,2,3,4 | ||
} | ||
|
||
string vstupUzivateleText = Console.ReadLine(); | ||
int vekUzivatele; | ||
bool povedloSePrevest = int.TryParse(vstupUzivateleText, out vekUzivatele); | ||
|
||
while(/*nepovedloSePrevest*/) | ||
Check failure on line 41 in src/Lekce04.Vyklad.Cykly/Program.cs
|
||
{ | ||
// donut uzivatele zadat vek znovu. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Cyklus FOR | ||
|
||
// Cyklus se opakuje urcit pocetkrat | ||
|
||
// int i=0; promenna i, typicky zacina na 0 | ||
// i < 3; podminka - DOKUD je splnena, opakuj cyklus | ||
// i++ - co se ma stat po kazdem opakovani, zde zvysujeme i o 1 | ||
for (int i = 0; i < 3; i = i + 2) // i += 2 | ||
{ | ||
Console.WriteLine(i); | ||
} | ||
|
||
int pocetChipsuVMisce = 3; | ||
for (int cisloChipsu = 1; cisloChipsu <= pocetChipsuVMisce; cisloChipsu++) | ||
{ | ||
Console.WriteLine("Jim chips cislo " + cisloChipsu); | ||
} | ||
|
||
for (int cisloChipsu = 0; cisloChipsu < pocetChipsuVMisce; cisloChipsu++) | ||
{ | ||
Console.WriteLine("Jim chips cislo " + (cisloChipsu + 1)); | ||
} | ||
|
||
// for (int i = 0; i < length; i++) | ||
// { | ||
|
||
// } |