F# 如何在F中获取逗号后的数字#
我想在F#中逗号后得到4个数字: 这是我的代码:F# 如何在F中获取逗号后的数字#,f#,F#,我想在F#中逗号后得到4个数字: 这是我的代码: // Learn more about F# at http://fsharp.org // See the 'F# Tutorial' project for more help. open System [<EntryPoint>] let main argv = let num = Console.ReadLine() |> float Console.WriteLine(num) Con
// Learn more about F# at http://fsharp.org
// See the 'F# Tutorial' project for more help.
open System
[<EntryPoint>]
let main argv =
let num = Console.ReadLine() |> float
Console.WriteLine(num)
Console.Read() |>ignore
0
//了解更多关于F#at的信息http://fsharp.org
//有关更多帮助,请参阅“F#Tutorial”项目。
开放系统
[]
让主argv=
让num=Console.ReadLine()|>float
控制台写入线(num)
Console.Read()|>忽略
0
结果如下:
open System
[<EntryPoint>]
let main argv =
let num = Math.Round(Console.ReadLine() |> float, 3)
Console.WriteLine(num)
Console.Read() |>ignore
0
开放系统
[]
让主argv=
设num=Math.Round(Console.ReadLine()|>float,3)
控制台写入线(num)
Console.Read()|>忽略
0
你的输入是什么?例如:3.141567892到3.141,我在逗号后得到了3个数字,你只想把你的浮点数四舍五入,对吗?所以这是一个很好的提问地方,但我认为对于初学者来说,问很多问题并不总是很好的,有时是模糊的问题。所以,我真的建议你加入。有一个#初学者频道,你可以在那里获得关于你问题的帮助。