C#基礎之------進位轉換

來源:互聯網
上載者:User

標籤:style   blog   http   color   os   io   strong   2014   

/************************

File:控制台進位類型轉換實現

Time:2014年8月12日

Author:小X

****************************/

 

 1 using System; 2 using System.Collections.Generic; 3 using System.Text; 4 using System.Threading;                        //需要用到線程 5 namespace Timer 6 { 7     class Program 8     { 9         static void Main(string[] args)10         {11             Console.WriteLine(Convert.ToInt64("111101", 2));//2進位的值轉換成64位整數12             Console.WriteLine(Convert.ToInt64("111107", 8));//8進位的值轉換成64位整數13             Console.WriteLine(Convert.ToInt32("111101", 10));//10進位的值轉換成32位整數14             Console.WriteLine(Convert.ToInt32("11110F", 16));//16進位的值轉換成32位整數15             //StopWatch sw = new StopWatch();16             //sw.Start();17             Console.WriteLine();18             Console.WriteLine(Convert.ToString(30, 2));//10進位的值轉換成2進位19             Console.WriteLine(Convert.ToString(30, 8));//10進位的值轉換成8進位20             Console.WriteLine(Convert.ToString(30, 10));//10進位的值轉換成10進位21             Console.WriteLine(Convert.ToString(30, 16));//10進位的值轉換成16進位22         }23     }

 

 

 

 

 

 

 

 

 

歡迎大家一起交流 ,分享程式員勵志故事。   幸福的程式員 QQ群:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.