各位大虾,谁能帮我写一个C#的 关于2个8位二进制数的相乘,急用
万分感谢

解决方案 »

  1.   

                byte b1 = 12;
                byte b2 = 21;            byte b3 = (byte)((int)b1 * (int)b2);小心溢出
      

  2.   

    void Main()
    {
        int16 ret;
        byte b1 = 12;
        byte b2 = 21;    ret = (int16)b1 * (int16)b2);
        console.WriteLine("{0} * {1} = {2}",b1 ,b2, ret );
        console.ReadLine();
    }返回值最大16位
      

  3.   

    byte[] arr1 = { 0, 0, 0, 0, 0, 0, 0, 1 };
    byte[] arr2 = { 0, 0, 0, 0, 0, 0, 0, 0 };
    Console.WriteLine(arr1[0] * arr2[0]);
    int.Parse(System.Text.Encoding.UTF8.GetString(arr1)) * ..;