Infinite loop in Quick Sort?
<p>When I run this program, I can reach the stage when I input the numbers, but the code simply stops working after that.</p>

<p>The cursor blinks, but I can't do a thing and neither can I input anything else.
If there is a mistake in the code, point it out or if there is a general mistake, then please enlighten me.</p>

<pre><code>#include&lt;iostream&gt;
using namespace std;
void sort(int *a, int o, int p, int r);
int main()
{

    int a[10],i,o=5,p=0,r=9;
    cout&lt;&lt;"Enter the elments \n";
    for(i=0; i&lt;10; i++)
    {
             cin&gt;&gt;a[i];
    }       
    sort(a,o,p,r);
    cout&lt;&lt;"\n The Sorted Array is";
    for(int yy=0; yy&lt;10; yy++)
    {
            cout&lt;&lt;a[yy]&lt;&lt;"\n";
    }
   system("PAUSE");
   return 0;
}
void sort(int *a, int o, int p, int r)
{
    int ii=0,kj=10,uu,uv,tmp;
    if(p&lt;r)
    {
        while((ii&lt;10)&amp;&amp;(kj&gt;0)){
            while(ii&lt;=o){
                ii++;
            }
            while(kj&gt;=o){
                kj--;
            }
            if(ii&lt;kj)
            {
                tmp=a[ii];
                a[ii] = a[kj];
                a[kj] = tmp;
            }
        }
        uu=(p+o)/2;
        uv=(r+o)/2;
        sort(a,uu,p,o);
        sort(a,uv,o,r);
    }               
}                  
</code></pre>
