Search This Blog

Sunday, October 23, 2016

Use of sort function to sort a array in C++

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

PDF to Text Covert by Oracle Apex

Here are the steps to convert and get the character into a region by Oracle Apex. Step1.  Create a page and Copy-Pest the below code into Pa...