static void Main() { ShowBits b = new ShowBits(8); ShowBits i = new ShowBits(32); ShowBits li = new ShowBits(64); Console.WriteLine("123 in binary: "); b.Show(123); Console.WriteLine("\n87987 in binary: "); i.Show(87987); Console.WriteLine("\n237658768 in binary: "); li.Show(237658768); }
static void Main(string [] args) { ShowBits sb1 = new ShowBits(8); ShowBits sb2 = new ShowBits(16); ShowBits sb3 = new ShowBits(32); ShowBits sb4 = new ShowBits(64); sb1.Show(123); sb2.Show(123); sb3.Show(123); sb4.Show(123); //sb2.Show(456); //sb3.Show(789); }
public static void Main(string[] args) { //ShowBits b = new ShowBits(8); //ShowBits i = new ShowBits(32); //ShowBits li = new ShowBits(64); //byte B = 123; //uint I = 87987; //ulong LI = 237658768; //System.Console.Write("\n" + B + " = "); //b.show(B); //System.Console.Write("\n" + I + " = "); //i.show(I); //System.Console.Write("\n" + LI + " = "); //li.show(LI); //System.Console.WriteLine(); int numbits; ulong number; if (args.Length < 2) { System.Console.WriteLine("Usage: ShowBits <lenght> <byte/uint/ulong>"); System.Console.WriteLine(" <lenght> = 8, 32, 64"); return; } else { if (!(int.TryParse(args[0], out numbits))) { System.Console.WriteLine("Error: Cannot read numbits"); return; } if (!(ulong.TryParse(args[1], out number))) { System.Console.WriteLine("Error: Cannot read number"); return; } } ShowBits sb = new ShowBits(numbits); sb.show(number); }
static void Main() { ShowBits b = new ShowBits(1024); b.Show(134252542422432425); }