???????
怎样调用系统的二进制????
程序代码:
/// <summary> /// 输入一个十进制 返回一个二进制 /// </summary> /// <param name="d"></param> /// <returns>装换成的二进制数</returns> public static string DtoB(int d) { string b = ""; //判断该数如果小于2,则直接输出 if (d < 2) { b = d.ToString(); } else { int c; int s = 0; int n = d; while (n >= 2) { s++; n = n / 2; } int[] m = new int[s]; int i = 0; do { c = d / 2; m[i++] = d % 2; d = c; } while (c >= 2); b = d.ToString(); for (int j = m.Length - 1; j >= 0; j--) { b += m[j].ToString(); } } return b; }