![Rank: 20](static/image/common/star_level3.gif) ![Rank: 20](static/image/common/star_level3.gif) ![Rank: 20](static/image/common/star_level3.gif) ![Rank: 20](static/image/common/star_level3.gif) ![Rank: 20](static/image/common/star_level3.gif)
- UID
- 390967
- 帖子
- 1775
- 主題
- 912
- 精華
- 0
- 積分
- 896
- 楓幣
- 15058
- 威望
- 435
- 存款
- 10100
- 贊助金額
- 1800
- 推廣
- 0
- GP
- 3034
- 閱讀權限
- 150
- 在線時間
- 215 小時
- 註冊時間
- 2023-5-18
- 最後登入
- 2025-2-17
|
無條件進位 (Math.Ceiling)- double src = 100;
- int res = 0;
- res = Convert.ToInt16(Math.Ceiling(src/3));
複製代碼 輸出 34
無條件捨去 (Math.Floor)- double src = 100;
- int res = 0;
- res = Convert.ToInt16(Math.Floor(src/3));
複製代碼 輸出 33
四捨五入- double src = 100;
- int res = 0;
- res = Convert.ToInt16(Math.Round(src/3));
複製代碼 輸出 33- double src = 100;
- double res = 0;
- res = Math.Round(src/3, 2); // 取到小數下第二位
複製代碼 輸出 33.33
另加收錄,將數字前幾位補0變字串- int src = 66;
- string s = src.ToString().PadLeft(4, '0');
複製代碼 輸出字串 0066
|
|