输入俩整数由大到小顺序输出

来源:互联网 发布:mc4d软件下载 编辑:程序博客网 时间:2024/06/05 06:09
#include<iostream>
using namespace std;
int main( )
{ void sort(int &,int &);
  int a,b;
  cin>>a>>b;
  if(a<b) sort(a,b);           
  cout<<a<<','<<b<<endl;
  return 0;
}
 
void sort(int &r1,int &r2)
{ int temp;
   temp=r1;
   r1=r2;
   r2=temp; 
}
0 0
原创粉丝点击