日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

小数 ###_C#中的小数关键字

發布時間:2023/12/1 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 小数 ###_C#中的小数关键字 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

小數 ###

C#十進制關鍵字 (C# decimal keyword)

In C#, decimal is a keyword which is used to declare a variable that can store a floating type value (value with the precision) between the range of ±1.0 x 10-28 to ±7.9228 x 1028. decimal keyword is an alias of System.Decimal.

在C#中, 十進制是一個關鍵字,用于聲明一個變量,該變量可以存儲介于±1.0 x 10 -28到±7.9228 x 10 28范圍內的浮點型值(精度值)。 十進制關鍵字是System.Decimal的別名。

It occupies 16 bytes (128 bits) in the memory.

它在內存中占用16個字節(128位)。

Note: To represent a decimal value, we use m or M as a suffix with the literal.

注意:為了表示一個十進制值,我們使用m或M作為文字的后綴。

Syntax:

句法:

decimal variable_name = value;

It can store the value between the range of ±1.0 x 10-28 to ±7.9228 x 1028.

它可以存儲介于±1.0 x 10 -28到±7.9228 x 10 28之間的值

C#代碼演示小數關鍵字的示例 (C# code to demonstrate example of decimal keyword)

Here, we are declaring a decimal variable num, initializing it with the value 5610.2361m and printing its value, type and size of a decimal type variable.

在這里,我們聲明一個十進制變量num ,使用值5610.2361m對其進行初始化,并打印其值,類型和十進制類型變量的大小。

using System; using System.Text;namespace ConsoleApplication3 {class Program{static void Main(string[] args){//char variable declarationdecimal num = 5610.2361m;//printing valueConsole.WriteLine("num: " + num);//printing type of variableConsole.WriteLine("Type of num: " + num.GetType());//printing size of a decimal Console.WriteLine("Size of a decimal variable: " + sizeof(decimal));//hit ENTER to exitConsole.ReadLine();}} }

Output

輸出量

num: 5610.2361 Type of num: System.Decimal Size of a decimal variable: 16

翻譯自: https://www.includehelp.com/dot-net/decimal-keyword-in-c-sharp.aspx

小數 ###

總結

以上是生活随笔為你收集整理的小数 ###_C#中的小数关键字的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。