標籤: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群: