Bubble Sort

So many of us have all done bubble sorts, however, I am new to c++ and this code is just not seeming to work for me. I want to check if a number is greater than the next in the array and swap them if it happens to be true. Here is the code for the swap function:
int pass =1;
int i=0;
int j;
double temp;
bool done = false;
while (!done && pass <=1)
{
done=true;
for (j=n-1; j>=pass; j--)
{
if (x[j]<x[j-1])
{
temp = x[j];
x[j]=x[j-1];
x[j-1]=temp;
i++;
cout<<endl<<". "<<setprecision(2)<<setw(9)<<fixed<<right<<x[j];
}
}
}
any ideas guys?? p.s. the readArray function should work fine, so it is a problem strictly within this portion of the code.
Topic archived. No new replies allowed.