Chinaunix首页 | 论坛 | 博客
  • 博客访问: 101240
  • 博文数量: 18
  • 博客积分: 1425
  • 博客等级: 上尉
  • 技术积分: 236
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-21 20:38
文章分类
文章存档

2011年(6)

2009年(10)

2008年(2)

我的朋友

分类: C/C++

2009-03-17 15:28:18


#include <iostream>

using namespace std;


int mby7(int n){
  int a=n<<3;
  int b=a&(-n);
  int tmp;
  a=a^(-n);
  while(b!=0){
    b=b<<1;
    tmp=a;
    a=a^b;
    b=tmp&b;
  }
  return a;
}


int main(){
  cout<<"2 multify by 7 is "<<mby7(2)<<endl;
}

阅读(1053) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~