码迷,mamicode.com
首页 > 其他好文 > 详细

C#基础之------进制转换

时间:2014-08-12 18:30:25      阅读:181      评论:0      收藏:0      [点我收藏+]

标签: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     }

 

 

 

 

 

 

 

bubuko.com,布布扣

 

 

欢迎大家一起交流 ,分享程序员励志故事。   幸福的程序员 QQ群bubuko.com,布布扣

C#基础之------进制转换,布布扣,bubuko.com

C#基础之------进制转换

标签:style   blog   http   color   os   io   strong   2014   

原文地址:http://www.cnblogs.com/1hua1ye/p/3907822.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!