Program For sorting Arry using sort function

           Program For sorting Arry using sort function

                                          Coding is     

#include <iostream>   
#include <algorithm>   
using namespace std;
bool myfunction (int i,int j) { return (i>j); }

int main ()

     {

    int size;   

cout<<"ENter the size of Arry "<<endl;

     cin>>size;       

         int myints[10];

         int e;

   

    for(e=0;e<size;e++)

    {

cout<<"enter arry num at loaction "<<e<< " ==";           

  cin>> myints[e];

    }

 vector<int> myvector (myints,myints+size);             

   std::sort (myvector.begin(), myvector.end(), myfunction);

   cout<<"the arrange of arry is"<<endl;

  for (int e=0;e<size;e++)

    cout<<myvector[e]<<endl;

  return 0;

}              

Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

Powered by Blogger.

Translate

 
 
.