第一章 第九题

来源:互联网 发布:中国进口食品数据 编辑:程序博客网 时间:2024/05/18 01:30

#include<iostream>

using namespace std;

int main()

{   

   int max(int &x,int &y,int &z);

   int a,b,c;

   cin>>a>>b>>c;

    max(a,b,c);

    cout<<b<<','<<a<<','<<c; 

return 0;

int max(int &x,int &y,int &z)

{    

     int temp,temp1;

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

    if(z>y&&z<x)  { temp=z;z=x;x=temp  ;       }

    if(z<y){temp=y;y=z; temp1=x;x=temp;z=temp1 ;}

}

0 0
原创粉丝点击