Sorting Array

Hi can u help me to write this program please...

Q: Write a program which will allow the user to define the size of array and allow him to prompt the number.Display the array in ascending order.

thx
1
2
3
4
int* a;
a = new int[size];
for (i = 0 to size) cin >> a[i];
std::sort(a, a+size);
Last edited on
what about

int a[n]

n* for unknown size of array?
That's not legal unless n is a constant. (And, obviously the size of the array would then be known.)

Using std::vector would be my choice.
ok thanks.... now i understand it better
Topic archived. No new replies allowed.