The CPPnew operator defines the array for bubble sorting, so what's wrong with it?

topic description

The

topic is to use the new operator to allocate memory for an array of 10 integers, then enter 10 integers from the keyboard, use bubbles to sort the output, and free up memory.

sources of topics and their own ideas

related codes

/ / Please paste the code text below (do not replace the code with pictures)

< H1 > include < iostream > < / H1 >

using namespace std;
void main ()
{

int *p,i,j,h;
p=new int[10];
for(i=0;i<10;iPP)
cin>>p[i];
for(i=0;i<10;iPP){
    for(j=0;j<10-i;jPP){
        if(p[i]>p[i+1]){
            h=p[i];
            p[i]=p[i+1];
            p[i+1]=h;}
    }
}
        cout<<endl;
for(i=0;i<10;iPP)
    cout<<p[i]<<" ";
delete p;

}

what result do you expect? What is the error message actually seen?

want to see the sorted results

Nov.25,2021
The inner part of the

loop is not subscript I, but J

.
Menu