hoare partition code does not work
<p>The following code for partition:</p>

<pre><code>#include&lt;iostream&gt;
using namespace std;
#define maxn 10000
int x[maxn];

void partition(int x[],int p,int r)
{
    int y=x[p];
    int i=p-1;
    int j=r+1;
    while(i&lt;j){
        do {
            j=j-1;
        } while( x[j]&gt;y);
        do {
            i=i+1;
        } while(x[j]&lt;y);
        if (i&lt;j){
            int s=x[i];
            x[i]=x[j];
            x[j]=s;
        }
        if (i&gt;=j) break;
    }
}

int main(){
    int n=12;
    for (int i=1;i&lt;=n;i++)
        cin &gt;&gt;x[i];
    partition(x,1,n);
    for (int i=1;i&lt;=n;i++)
        cout&lt;&lt;x[i]&lt;&lt;" ";
    return 0;
}
</code></pre>

<p>does not work. It means that. when I enter some numbers and press enter, it  does not write anything, neither partitioned array of course. Please help me.</p>
