Q:

Infinite loop in Quick Sort?

When I run this program, I can reach the stage when I input the numbers, but the code simply stops working after that.
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.
#include<iostream>
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<<"Enter the elments \n";
    for(i=0; i<10; i++)
    {
             cin>>a[i];
    }       
    sort(a,o,p,r);
    cout<<"\n The Sorted Array is";
    for(int yy=0; yy<10; yy++)
    {
            cout<<a[yy]<<"\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<r)
    {
        while((ii<10)&&(kj>0)){
            while(ii<=o){
                ii++;
            }
            while(kj>=o){
                kj--;
            }
            if(ii<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);
    }               
}                  

A:

Why are you comparing indices in your sort routine? Shouldn't you be comparing values at indices? 
What you think this is supposed to do?
void sort(int *a, int o, int p, int r)
{                               // call in with o=5, p=0, r=9
    int ii=0,kj=10,uu,uv,tmp;   
    if(p<r)
    {
        while((ii<10)&&(kj>0)){
            while(ii<=o){
                ii++;
            }                  // ii is now 6
            while(kj>=o){
                kj--;
            }                  // kj is now 4
            if(ii<kj)          // NEVER true
            {
                tmp=a[ii];
                a[ii] = a[kj];
                a[kj] = tmp;
            }
        }                      // infinite loop

Not less importantly, why are you using the hard-coded value 5 for your pivot value? Why do you call it o and not p at least? One-letter names for vars are fine only if they are either self-evident, or explained with a comment.

