using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace ConsoleApplication3
{
    class Program
    {

        static void Main(string[] args)
        {
            ///<summary>
            /// 移位运算           
            ///</summary>
            int i = 7;
            int j = 2;
            Console.WriteLine(i >> j);   //输出结果为1

            ///<summary>
            /// 异或运算
            ///</summary>
            int x = 5;
            int y = 3;
            y ^= x;   //等价与y=y^x
            Console.WriteLine(y);        ////输出结果为6

            ///<summary>
            /// 或运算           
            ///</summary>
            int i = 7;
            int j = 2;
            Console.WriteLine(i | j);   //输出结果为7

            ///<summary>
            /// 与运算           
            ///</summary>
            int i = 7;
            int j = 2;
            Console.WriteLine(i & j);   //输出结果为2
        }
    }
}

相关文章:

  • 2021-11-05
  • 2022-02-08
  • 2021-12-05
  • 2022-02-08
  • 2021-12-05
  • 2022-02-09
  • 2022-02-08
猜你喜欢
  • 2021-07-21
  • 2021-06-24
  • 2022-12-23
相关资源
相似解决方案