位置:首頁 > 軟件操作教程 > 編程開發(fā) > C# > 問題詳情

String類的用法

提問人:劉冬梅發(fā)布時(shí)間:2020-10-13
1.string.Format實(shí)現(xiàn)字符串的格式化

2.輸入兩個(gè)整數(shù),輸出他們的實(shí)數(shù)除商,并輸出上的第二位小數(shù)

static void Main()

        {

            int i = Convert.ToInt32(Console.ReadLine());

            int j = Convert.ToInt32(Console.ReadLine());

            double shang = (double)i / j;

            string str = string.Format("{0:F3}", shang);

            char c = str[str.Length - 2];

            Console.WriteLine(c);

            Console.Read();

        }


繼續(xù)查找其他問題的答案?

相關(guān)視頻回答
回復(fù)(0)
返回頂部