It's a example of doing sort by using sort function in C++. We can use this function to sort
normal any numbers very easily .
#include
using
namespace
std;
int
main()
{
int
arr[] = {1, 5, 8, 9, 6, 7, 3, 4, 2, 0};
int
n =
sizeof
(arr)/
sizeof
(arr[0]);
sort(arr, arr+n);
cout <<
"\nArray after sorting using "
"default sort is : \n"
;
for
(
int
i = 0; i < n; ++i)
cout << arr[i] <<
" "
;
return
0;
}
No comments:
Post a Comment