C语言

  1. 位运算具体应用、

    1. 位左为最高位、右为最低为、从右往左看、

    2. #define a(c) (1<<(c))
      int main()
      
      {
      	int b;
      	for ( b = 0; b < 20; b++)
      
      	{
      		printf("a(%d)=%d\n", b, a(b));
      
      	}
      
      
      }
      
    3. #define a(c) (1<<(c))
      int main()
      {
      	
      	enum b
      	{
      		b1 = a(0),
      		b2 = a(1),
      		b3 = a(2),
      		b4 = a(3),
      		b5 = a(4),
      		b6 = a(5),
      		b7 = a(6),
      		b8 = a(7),
      		
      	};
      	unsigned int e = 0;
      	//显示6 修改6
      	if (e & b6)
      	{
      		printf("显示6\n");
      
      	}
      	else
      	{
      		printf("没显示\n");
      		e = e | b6;
      	}
      	
      	if (e & b6)
      	{
      		printf("显示6\n");
      
      	}
      	else
      	{
      		printf("没显示\n");
      	}
      }
      
  2. 常用于算法和密码学、

posted on 2020-09-21 14:50  程耀辉  阅读(129)  评论(0编辑  收藏  举报