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
        }
    }
}

posted on 2010-04-21 18:32  aparche  阅读(22621)  评论(0编辑  收藏  举报