您的位置:首页 > 其它

输入三个整数,将他们排序然后输出中间那个数

2015-08-27 11:15 162 查看
#include<iostream>

using namespace std;

int main()

{

void sort(int x,int y,int z);

int a,b,c;

cin>>a>>b>>c;

sort(a,b,c);

return 0;

}

void sort(int x,int y,int z)

{

int temp;

if(x>y){temp=x;x=y;y=temp;}

if(z<x) cout<<x<<endl;

else if(z<y) cout<<z<<endl;

else cout<<y<<endl;

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