博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
不用加减乘除做加法
阅读量:4687 次
发布时间:2019-06-09

本文共 628 字,大约阅读时间需要 2 分钟。

1 #include 
2 #include
3 #include
4 #include
5 #include
6 #include
7 #include
8 #include
9 #include
10 #include
11 using namespace std;12 #define debug(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl13 int addusingbit(int a, int b){14 15 while (b != 0) {16 int result = a^b;17 int jinzhi = (a&b)<<1;18 a = result;19 b = jinzhi;20 }21 return a;22 }23 int main()24 {25 int a=17,b=15;26 printf("%d\n", addusingbit(a,b));27 return 0;28 }

 

转载于:https://www.cnblogs.com/guxuanqing/p/5927344.html

你可能感兴趣的文章
31、任务三十一——表单联动
查看>>
python之hasattr、getattr和setattr函数
查看>>
maven使用阿里镜像配置文件
查看>>
Copy code from eclipse to word, save syntax.
查看>>
arguments.callee的作用及替换方案
查看>>
23 Java学习之RandomAccessFile
查看>>
P2709 小B的询问
查看>>
润乾报表 动态控制文本的显示
查看>>
[oracle] 如何使用myBatis在数据库中插入数据并返回主键
查看>>
PHP echo 和 print 语句
查看>>
第一讲 一个简单的Qt程序分析
查看>>
Centos 6.5下的OPENJDK卸载和SUN的JDK安装、环境变量配置
查看>>
poj 1979 Red and Black(dfs)
查看>>
【.Net基础03】HttpWebRequest模拟浏览器登陆
查看>>
UML-画类图与交互图的顺序
查看>>
6月7 考试系统
查看>>
mysql 基本操作
查看>>
zTree async 动态参数处理
查看>>
Oracle学习之常见错误整理
查看>>
HTC Sensation G14开盒
查看>>