// bubble sort
// loop to control number of passes
for ( int pass = 0; pass
< arraySize - 1; pass++ )
{
// loop to control number of comparisons
per pass
for ( int j = 0; j < arraySize - 1; j++
)
{
// compare side-by-side elements and
swap them if
// first element is greater than
second element
if ( a[ j ] > a[ j + 1 ]
)
{
hold = a[ j ];
a[ j ] = a[ j + 1 ];
a[ j + 1 ] =
hold;
} // end if
}
}
cout << "\nData
items in ascending order\n";
// output sorted array
for ( int k = 0; k < arraySize; k++ )
cout << “\t” << a[ k ];
cout << endl;
return 0;
// indicates successful termination
} // end main