国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
C# 自定義格式化字符串Console.WriteLine,Console....
//  This  project  illustrates  basic  I/O
//  with  the  console  and  .NET  string  formatting.
using  System;
using  System.Collections.Generic;
using  System.Linq;
using  System.Text;
//自定義格式化字符串
namespace  BasicConsoleIO
{
    class  Program
    {
        static  void  Main(string[]  args)
        {
            Console.WriteLine("*****  Basic  Console  I/O  *****");
            GetUserData();
            Console.WriteLine();
            FormatNumericalData();
            Console.ReadLine();
        }
        #region  Formatting
        //  Now  make  use  of  some  format  tags.
        static  void  FormatNumericalData()
        {
                /*
                  C  或  c                    貨幣                        Console.Write("{0:C}",  2.5);          $2.50
                                                                                  Console.Write("{0:C}",  -2.5);        ($2.50)
                  D  或  d                  十進(jìn)制數(shù)                  Console.Write("{0:D5}",  25);            00025
 
                  E  或  e                  科學(xué)型                      Console.Write("{0:E}",  250000);    2.500000E+005
                  F  或  f                  固定點(diǎn)                      Console.Write("{0:F2}",  25);          25.00
                                                                                  Console.Write("{0:F0}",  25);          25
                  G  或  g                  常規(guī)                          Console.Write("{0:G}",  2.5);          2.5
                  N  或  n                  數(shù)字                          Console.Write("{0:N}",  2500000);  2,500,000.00
                  X  或  x                  十六進(jìn)制                  Console.Write("{0:X}",  250);          FA
                                                                                  Console.Write("{0:X}",  0xffff);    FFFF
                  */
            Console.WriteLine("The  value  99999  in  various  formats:");
            Console.WriteLine("c  format:  {0:c}",  99999);
           
            Console.WriteLine("d9  format:  {0:d9}",  99999);
            //指定小數(shù)位數(shù)的浮點(diǎn)數(shù)表示
            Console.WriteLine("f3  format:  {0:f3}",  99999);
            Console.WriteLine("n  format:  {0:n}",  99999);
           
            //  Notice  that  upper  or  lower  casing  for  hex 
            //  determines  if  letters  are  upper/lowercase.
            //科學(xué)計(jì)數(shù)法表示   
            Console.WriteLine("E  format:  {0:E}",  99999);
            Console.WriteLine("e  format:  {0:e}",  99999);
            //十六進(jìn)制表示
            Console.WriteLine("X  format:  {0:X}",  99999);
            Console.WriteLine("x  format:  {0:x}",  99999);
        }
        #endregion
        #region  Get  user  data.
        static  void  GetUserData()
        {
            //  Get  name  and  age.
            Console.Write("Please  enter  your  name:  ");
            string  userName  =  Console.ReadLine();
            Console.Write("Please  enter  your  age:  ");
            string  userAge  =  Console.ReadLine();
            //  Change  echo  color,  just  for  fun.
            ConsoleColor  prevColor  =  Console.ForegroundColor;
            Console.ForegroundColor  =  ConsoleColor.Yellow;
            //  Echo  to  the  console.
            Console.WriteLine("Hello  {0}!    You  are  {1}  years  old.",
                    userName,  userAge);
            //  Restore  origional  color.
            Console.ForegroundColor  =  prevColor;
        }
        #endregion
    }
}
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Console
C# 代碼詮釋"每天進(jìn)步一點(diǎn)點(diǎn)"
學(xué)習(xí)Console.Write() Console.WriteLine() Console.Read() Console.ReadLine()方法的使用
C#字符串類String的使用(二)
淺談C sharp編程和入門(二)
統(tǒng)計(jì)某個(gè)字符串中指定字符串出現(xiàn)的次數(shù)
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服