- #include <iostream>
- using std::cout;
- using std::cin;
- using std::endl;
- void main()
- {
- int a,b;
- cout<<"please input two number"<<endl;
- cin>>a>>b;
- cout<<"a="<<a<<"; "<<"b="<<b<<endl;
- a=a+b;
- b=a-b;
- a=a-b;
- cout<<"a="<<a<<"; "<<"b="<<b<<endl;
- }
交换两个数,并且不使用第三块内存
最新推荐文章于 2023-03-25 15:08:10 发布