C++:输入两个整数,将它们按从小到大的顺序输出(使用变量的引用)
2016-05-15 18:24
926 查看
4000
#include<iostream> //预操作 #include<cmath> using namespace std;// 使用命名空间std void min(int &c, int &d) { if (c > d) { cout << d << " " << c << endl; } else if (c < d); { cout << c << " " << d << endl; } if(c==d) { cout << "The two numbers are equal" << endl; } } int main() { int a,b; cout << "Please printf two numbers:" << endl; cin >> a >> b; cout << "Two numbers from small to large order is:"<<" "; min(a, b); system("pause"); return 0; }
相关文章推荐
- C++:建立一个被称为sroot()的函数,返回其参数的二次方根。重载sroot()3次,让它返回整数、长整数与双精度的二次方根
- 怎样创建一个链表?
- C/C++对文件的读写
- C++——C/C++static关键字
- c语言之被遗漏的角落---#pragma pack
- C++第5次作业
- c++作业5
- C语言--乘法口诀
- C++ 11(八)
- c++作业5
- c++动态绑定与静态绑定中的函数调用与函数缺省参数
- c++实验五
- C++ 使用模板实现的一个List
- 在mac上编译安装Protocol Buffer (C++)
- C++ HASH_MAP初探
- (MFC)在任意位置拖动窗口或弹出窗口菜单
- 用C语言实现控制台模拟显示时
- vector类c++ && BFS
- C++设计模式浅识简单工厂模式
- c++ 创建用当前时间命名的文件夹