帮我看看那错了 谢谢
#include <iostream.h>
#include <math.h>
void order(int *p,int n)
{int temp;
for (int i=0;i<n;i++)
for(int j=0;j<n-i;j++)
if (p[j]<p[j+1])
{
temp=p[j];
p[j]=p[j+1];
p[j+1]=temp;
}
cout<<"排序后为:";
for (int b=0;b<n;b++)
cout<<p[b]<<endl;
}
void main()
{
int n;
cin>>n;
int *p=new int(n);
order(p,n);
delete p;
}
#include <math.h>
void order(int *p,int n)
{int temp;
for (int i=0;i<n;i++)
for(int j=0;j<n-i;j++)
if (p[j]<p[j+1])
{
temp=p[j];
p[j]=p[j+1];
p[j+1]=temp;
}
cout<<"排序后为:";
for (int b=0;b<n;b++)
cout<<p[b]<<endl;
}
void main()
{
int n;
cin>>n;
int *p=new int(n);
order(p,n);
delete p;
}