引用调用的用法

来源:互联网 发布:二维数组排序 php 编辑:程序博客网 时间:2024/05/21 17:29
#include <iostream>
using namespace std;
swap(int & a,int & b)
{
    int tmp;
    tmp=a;
    a=b;
    b=tmp;

}
void main()
{
    int x,y;
    cout << "input two number " << endl;
    cin >> x;
    cin >> y;

    if(x<y)
        swap(x,y);
    cout << "x=" << x <<endl;
    cout << "y=" << y <<endl;
}
0 0
原创粉丝点击