开源是程序员的基本美德
很多时候,需要转换的时候,基本上都是面向百度编程,直接找百度,有很多在线转换的网站。而且很多开发语言包,都提供了转换方法,基本不需要开发者自己去思考,直接调用即可。那么,如果让自己实现,其实并没有想象中的那么简单。
static void Main(string[] args) { int tem = 356; List<int> arr = new List<int>(); while (tem / 2 > 0) { arr.Add(tem % 2); tem = tem / 2; } if (tem > 0) { arr.Add(tem); } for (int i = arr.Count - 1; i >= 0; i--) { Console.Write(arr[i]); } Console.ReadKey(); }
留下您的脚步
最近评论