29
This commit is contained in:
parent
a26c86e2ac
commit
828ce0a5c5
3 changed files with 44 additions and 22 deletions
|
@ -1,4 +1,4 @@
|
||||||
module UlohyFs.u28
|
module UlohyFs.u29
|
||||||
|
|
||||||
open System.IO
|
open System.IO
|
||||||
open System.Text.RegularExpressions
|
open System.Text.RegularExpressions
|
||||||
|
@ -6,25 +6,16 @@ open System.Text.Unicode
|
||||||
open UlohyFs.Attributes
|
open UlohyFs.Attributes
|
||||||
open System
|
open System
|
||||||
|
|
||||||
let (./.) l r = $"{l}{Path.PathSeparator}{r}"
|
let napoje = [| 20; 55; 45; 95; 150; 105; 100; 45 |]
|
||||||
|
|
||||||
|
[<Uloha(29)>]
|
||||||
let getHobit =
|
let uloha29() =
|
||||||
Environment.GetFolderPath(Environment.SpecialFolder.Desktop) ./. "maturita" ./. "ZADANIE č.19" ./. "hobit.txt"
|
printfn "napoje:"
|
||||||
|> fun x -> if File.Exists x then Some(x) else None
|
napoje |> Array.iteri (fun i x -> printfn $"{i + 1}. cena: {x}")
|
||||||
|> function
|
let inp = Console.ReadLine().Trim() |> int
|
||||||
| Some(v) -> File.ReadAllText v
|
let mutable cena = napoje[inp - 1]
|
||||||
| None ->
|
while not (cena <= 0) do
|
||||||
printfn "Nepodarilo sa najst hobit.txt zadaj cestu k hobit.txt"
|
printfn "vhod mincu, este treba %d" cena
|
||||||
let inp = Console.ReadLine()
|
let minca = Console.ReadLine().Trim() |> int
|
||||||
File.ReadAllText inp
|
cena <- cena - minca
|
||||||
|
printfn "vydavok: %d" (Math.Abs cena)
|
||||||
[<Uloha(28)>]
|
|
||||||
let uloha28() =
|
|
||||||
let h = getHobit
|
|
||||||
let mutable spaces = 0
|
|
||||||
h
|
|
||||||
|> String.iter (fun c -> if c = ' ' then spaces <- spaces + 1)
|
|
||||||
printfn "medzery: %d" spaces
|
|
||||||
h
|
|
||||||
|> printfn "%s"
|
|
30
ulohyfs/src/u29.fs
Normal file
30
ulohyfs/src/u29.fs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
module UlohyFs.u28
|
||||||
|
|
||||||
|
open System.IO
|
||||||
|
open System.Text.RegularExpressions
|
||||||
|
open System.Text.Unicode
|
||||||
|
open UlohyFs.Attributes
|
||||||
|
open System
|
||||||
|
|
||||||
|
let (./.) l r = $"{l}{Path.PathSeparator}{r}"
|
||||||
|
|
||||||
|
|
||||||
|
let getHobit =
|
||||||
|
Environment.GetFolderPath(Environment.SpecialFolder.Desktop) ./. "maturita" ./. "ZADANIE č.19" ./. "hobit.txt"
|
||||||
|
|> fun x -> if File.Exists x then Some(x) else None
|
||||||
|
|> function
|
||||||
|
| Some(v) -> File.ReadAllText v
|
||||||
|
| None ->
|
||||||
|
printfn "Nepodarilo sa najst hobit.txt zadaj cestu k hobit.txt"
|
||||||
|
let inp = Console.ReadLine()
|
||||||
|
File.ReadAllText inp
|
||||||
|
|
||||||
|
[<Uloha(28)>]
|
||||||
|
let uloha28() =
|
||||||
|
let h = getHobit
|
||||||
|
let mutable spaces = 0
|
||||||
|
h
|
||||||
|
|> String.iter (fun c -> if c = ' ' then spaces <- spaces + 1)
|
||||||
|
printfn "medzery: %d" spaces
|
||||||
|
h
|
||||||
|
|> printfn "%s"
|
|
@ -17,6 +17,7 @@
|
||||||
<Compile Include="src\u26.fs" />
|
<Compile Include="src\u26.fs" />
|
||||||
<Compile Include="src\u27.fs" />
|
<Compile Include="src\u27.fs" />
|
||||||
<Compile Include="src\u28.fs" />
|
<Compile Include="src\u28.fs" />
|
||||||
|
<Compile Include="src\u29.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