How can my random number generator come up from lowest to highest in C++?
<p>I have an app that insta picks your numbers for the lotto. I have tried adding an array, I tried the Bubble method, but I dont know where to incorporate it into my code. I have tried multi times and different ways but I keep getting errors. Any advice?</p>

<pre><code>/*This app will give you your lotto max numbers!*/
#include &lt;iostream&gt; 
#include &lt;iomanip&gt;
#include &lt;cstdlib&gt;
using namespace std;

int main()
{
    int lotto[7];
    //allows users to input a seed, that way the tickets wont be 
    //generated the same if    they want two.
    unsigned seed;
    cout &lt;&lt; "Enter seed ";
    cin &gt;&gt; seed;
    srand( seed ) ;

    //greeting
    cout &lt;&lt; "*** LOTTO  MAX  INSTA  PICK ***" &lt;&lt; endl;
    cout &lt;&lt; " " &lt;&lt; endl &lt;&lt; endl;

    cout &lt;&lt; "Your Insta Pick Numbers" &lt;&lt; endl;
    cout&lt;&lt; " " &lt;&lt; endl &lt;&lt; endl;

    //initilizes the counter and making sure the amount of numbers does not exceed 21
    for (int counter = 1; counter &lt;= 7;++ counter)
    {
        //outputs numbers between 1 and 27 with 7 numbers in each row 
        cout &lt;&lt; setw(1) &lt;&lt; (1 + rand() % 49)  &lt;&lt; " " ;
        //stops the counter for each row 
        if (counter % 7 == 0)
            cout &lt;&lt; endl;
    }

    //space in between the numbers and tag numbers
    cout&lt;&lt; " " &lt;&lt; endl &lt;&lt; endl;
    cout &lt;&lt; "Your Tag Numbers" &lt;&lt; endl;
    cout &lt;&lt; " " &lt;&lt; endl &lt;&lt; endl;

    //initilizes counter and makes sure numbers dont go over 6
    for (int counter = 1; counter &lt;= 6; ++ counter)
    {
        //sets the numbers between 0 and 9 and outputs them
        cout &lt;&lt; setw(0) &lt;&lt; (0 + rand() % 9)&lt;&lt; " " ;

        //stops the counter 
        if (counter % 9 == 0)
            cout &lt;&lt; endl;
    }

    cout &lt;&lt; " " &lt;&lt; endl &lt;&lt; endl;

    //end message
    cout &lt;&lt; "Thank you for playing!! please check ticket\n a year minus a day   from date of purchase" &lt;&lt;endl;
};
</code></pre>
