C++ Whats wrong with this code??

¿?

#include <iostream>

using namespace std;
int funcion(int& a, int& b, int& c){
int aux=0;
int auxa=0;
do{
if(a>b && a>c){
aux=c;
c=a;
a=aux;
}

if (a>b){
auxa=b;
b=a;
a=auxa;
}


}while(a<=b && b<=c);
return aux;
}
int main()
{
int aux=0,a,b,c;
int auxa=0;
int orden;
cin>>a;
cin>>b;
cin>>c;
funcion(a,b,c);
cout<<a<<endl;
cout<<b<<endl;
cout<<c<<endl;

return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

void rearrange( int& a, int& b, int& c ) // void if there is nothing to return
{
    int aux ;

    if( a > b ) { aux = a ; a = b ; b = aux ; }
    if( b > c ) { aux = b ; b = c ; c = aux ; }
    if( a > b ) { aux = a ; a = b ; b = aux ; }
}

int main()
{
    int a, b, c ;
    std::cin >> a >> b >> c ;
    std::cout << "before: " << a << ' ' << b << ' ' << c << '\n' ;

    rearrange( a, b, c ) ;
    std::cout << " after: " << a << ' ' << b << ' ' << c << '\n' ;
}
thank you very much
Topic archived. No new replies allowed.