您的位置:首页 > 编程语言 > C语言/C++

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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: