Sort three input values by order This is a program to sort three inputted integers in order, from least to greatest. I would like to have it reviewed. 

#include &lt;iostream&gt;

void Sort(int &amp;a, int &amp;b, int &amp;c){
    if(a&gt;b){
        int tmp = a;
        a = b;
        b = tmp;
    }
    if(a&gt;c){
        int tmp = a;
        a=c;
        c = tmp;
    }
    if(b&gt;c){
        int tmp = b;
        b=c;
        c=tmp;
    }
    return;
}

int main(){
    std::cout &lt;&lt; "Enter three integers: " &lt;&lt; std::endl;
    int num1;
    int num2;
    int num3;
    std::cin &gt;&gt; num1 &gt;&gt; num2 &gt;&gt; num3;

    int output1 = num1;
    int output2 = num2;
    int output3 = num3;

    Sort(output1,output2,output3);

    std::cout &lt;&lt; num1 &lt;&lt; " " &lt;&lt; num2 &lt;&lt; " " &lt;&lt; num3 &lt;&lt; " "
         &lt;&lt; " in sorted order: ";
    std::cout &lt;&lt; output1 &lt;&lt; " " &lt;&lt; output2 &lt;&lt; " " &lt;&lt; output3 &lt;&lt; std::endl;

    return 0;
}
Things you should change:


Sort() is explicitly returning at the end (return;). The return statement is implicit once you reach the end of a void function, so should not appear.
Pay attention to the spacing between the = sign. In some places you have b=c; while in others you have a = b; Be consistent with the spacing. I suggest the latter, as it seems more readable to me.
You don't have to return 0 from main. For main(), the return zero is implicit if not added.




This is also a great opportunity for you to learn about C++ templates. I will suggest you a base implementation that you can study, test, and better understand the awesomeness of this language feature:

template&lt;typename T&gt;
void swap_if_greater(T&amp; a, T&amp; b)
{
    if (a &gt; b)
    {
        T tmp(a);
        a = b;
        b = tmp;
    }
}

template&lt;typename T&gt;
void sort(T&amp; a, T&amp; b, T&amp; c)
{
    swap_if_greater(a, b);
    swap_if_greater(a, c);
    swap_if_greater(b, c);
}


Just as in the example provided by @EngieOP, I've added a swap function to reuse more code.
I've also better separated common code by moving the conditional inside the swap function (swap_if_greater()), since it is common to all inputs. 

sort() is now a template function, meaning is can operate on any type, including int, float, double, char, ... It is a generic function, just as many of the functions in the standard C++ library. This concept promotes great code reuse and low redundancy of functionality.