-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#14 - zahájení kombinované úlohy (NEDOKONČENO)
- Loading branch information
Showing
3 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
IS-Projekty/014-app14-kombinovana-uloha/014-app14-kombinovana-uloha.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,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<RootNamespace>_014_app14_kombinovana_uloha</RootNamespace> | ||
<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,45 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
Console.WriteLine("Kombinovaná úloha - Lukáš Moravec\n"); | ||
|
||
int count, min, max; | ||
bool valid = true; | ||
int[] output; | ||
|
||
Console.Write("Zadejte počet čísel k vygenerování N (celé číslo): "); | ||
while (!int.TryParse(Console.ReadLine(), out count)) | ||
Console.Write("Chybně zadané celé číslo!! \nZadejte znovu: "); | ||
|
||
do | ||
{ | ||
if (!valid) | ||
Console.WriteLine("\n!!! Spodní mez musí být menší než horní mez !!!\n"); | ||
|
||
Console.Write("Zadejte dolní mez (celé číslo): "); | ||
while (!int.TryParse(Console.ReadLine(), out min)) | ||
Console.Write("Chybně zadané celé číslo!! \nZadejte znovu: "); | ||
|
||
Console.Write("Zadejte horní mez (celé číslo): "); | ||
while (!int.TryParse(Console.ReadLine(), out max)) | ||
Console.Write("Chybně zadané celé číslo!! \nZadejte znovu: "); | ||
|
||
valid = min < max; | ||
} | ||
while (!valid); | ||
|
||
output = new int[count]; | ||
Random random = new(); | ||
Console.WriteLine("Konfigurace generátoru je počet čísel: {0}, horní mez: {1}, dolní mez {2}", count, max, min); | ||
|
||
Console.WriteLine("Náhodně vygenerovaná čísla: "); | ||
for (int i = 0; i < count; i++) | ||
{ | ||
output[i] = random.Next(min, max); | ||
Console.Write("{0}, ", output[i]); | ||
} | ||
Console.WriteLine("\n----------------"); | ||
|
||
void printArray() | ||
{ | ||
|
||
} |
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