How to make numbers not repeated in a random number generated app in C++?
<p>I have an app that will display Lotto Max numbers, I need to make my app generate random numbers but I need the numbers to not repeat. I have my code done and would like to change a little as possible. But any help would be awesome!</p>

<pre><code>    #include &lt;iostream&gt; 
    #include &lt;iomanip&gt;
    #include &lt;cstdlib&gt;
    using namespace std;

    int main()
    {

    {
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;
     }
 for (int counter = 1; counter &lt;= 21; ++ counter)
{

cout &lt;&lt; setw(1) &lt;&lt; (1 + rand() % 49) &lt;&lt; " ";


if (counter % 7 == 0)
        cout &lt;&lt; endl;
}
{
    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;
    }
for (int counter = 1; counter &lt;= 9; ++ counter)
{

cout &lt;&lt; setw(1) &lt;&lt; (0 + rand() % 9)&lt;&lt; " ";


if (counter % 9 == 0)
        cout &lt;&lt; endl;

}
{
    cout&lt;&lt; " " &lt;&lt; endl &lt;&lt; endl;
}
{
    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>
