24
This commit is contained in:
parent
052267d143
commit
f917420104
2 changed files with 25 additions and 0 deletions
24
ulohyfs/src/u24.fs
Normal file
24
ulohyfs/src/u24.fs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
module UlohyFs.u24
|
||||||
|
|
||||||
|
open System.IO
|
||||||
|
open System.Text.Unicode
|
||||||
|
open UlohyFs.Attributes
|
||||||
|
open System
|
||||||
|
|
||||||
|
let noMessages = [| "Ups, vedľa ako tá jedľa!"; "No, toto ti nevyšlo."; "Skús ešte raz, možno sa stane zázrak."; "Tak toto bolo fakt mimo."; "Si vedľa, ako keby si spadol z višne."; "Nie, ale aspoň si sa snažil!"; "Skoro, ale len pre kone."; "To je síce pekné, ale nesprávne."; "Si na míle vzdialený od správnej odpovede."; "Nie, ale máš aspoň dobrú fantáziu!"; "Žiaľ, tvoja odpoveď je taká zlá, že ju ani nebudem komentovať. " |]
|
||||||
|
|
||||||
|
[<Uloha(24)>]
|
||||||
|
let uloha24() =
|
||||||
|
printfn "myslim si cislo od 1 do 10, hadaj:"
|
||||||
|
let rng = Random()
|
||||||
|
let cislo = rng.Next(1, 11)
|
||||||
|
let mutable hadane = 0
|
||||||
|
let mutable pokusy = 0
|
||||||
|
while hadane <> cislo do
|
||||||
|
hadane <- Console.ReadLine() |> int
|
||||||
|
pokusy <- pokusy + 1
|
||||||
|
if hadane <> cislo then
|
||||||
|
let r = rng.Next(0, noMessages.Length)
|
||||||
|
printfn "%s" noMessages.[r]
|
||||||
|
|
||||||
|
printfn "Gratulujem, uhádol si na %d. pokus!" pokusy
|
|
@ -16,6 +16,7 @@
|
||||||
<Compile Include="src\u15.fs" />
|
<Compile Include="src\u15.fs" />
|
||||||
<Compile Include="src\u22.fs" />
|
<Compile Include="src\u22.fs" />
|
||||||
<Compile Include="src\u23.fs" />
|
<Compile Include="src\u23.fs" />
|
||||||
|
<Compile Include="src\u24.fs" />
|
||||||
<Compile Include="src\u17.fs" />
|
<Compile Include="src\u17.fs" />
|
||||||
<Compile Include="src\u18.fs" />
|
<Compile Include="src\u18.fs" />
|
||||||
<Compile Include="src\u19.fs" />
|
<Compile Include="src\u19.fs" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue