如何打印浮点型 [英] how to print float type

查看:347
本文介绍了如何打印浮点型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

如何使用C#打印float/double类型? 使用Console.WriteLine命令吗?


如何控制小数点后的数字(###.#####)?

thx
yuda

hello

how to print float/double types using C# ?
using Console.WriteLine command ?


how to control the digit after the decimal point (###.#####)?

thx
yuda

推荐答案

您将要使用string.Format或someFloat.ToString("string format").通常,您可以显示如下所示的浮点数:
You''ll want to use string.Format or someFloat.ToString("string format"). In general, you can show a float like this:
System.Console.Out.WriteLine(myFloat.ToString());


这篇关于如何打印浮点型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆