c# 输入框 整数浮点数
The task is to take an input of a float value and print it on the console in C#.
任务是获取浮点值的输入并将其在C#中的控制台上打印。
As, we have discussed in earlier programs that to read any value, we use Console.ReadLine() method and if the desired value is not in the string format, we need to convert it into the specific type.
正如我们在较早的程序中所讨论的,要读取任何值,我们使用Console.ReadLine()方法,如果所需的值不是字符串格式,则需要将其转换为特定的类型。
There are some of the common and popular ways to convert a value to the float,
有一些常见的方法将值转换为浮点数,
float.Parse() method – Here, float is an alias of Single class and Parse() is its method – it converts given string value to the float value.
float.Parse()方法 –在这里, float是