//new -- allocate memory
#include
using namespace std;
int main()
{
int n;
int *p;
//seed random-number generator
srand(time(0));
//input array size n
cout
cin >> n;
//allocate memory
p = new int[n+1];
//before sort
for (int i = 0; i
*(p+i) = rand() % 6;
}
//please write sort function yourself
sort(p,p+n);
//After sort
//release memory
delete p;
return 0;
//new -- allocate memory
#include
using namespace std;
#include
#include
#include
int main()
{
int n;
int *p;
//seed random-number generator
srand(time(0));
//input array size n
cout
cin >> n;
//allocate memory
p = new int[n+1];
//before sort
cout
for (int i = 0; i
{
*(p+i) = rand() % 6;
cout
}
cout
//please write sort function yourself
sort(p,p+n);
//After sort
cout
for (int i = 0; i
{
cout
}
cout
//release memory
delete p;
return 0;
}