topic description
Thetopic 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