User Tools

Site Tools


c_-_c_sorts:array_sort

C - C++ Sorts - Array Sort

#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
 
int main()
{
  int x[]={10,50,30,40,20};
  int y[]={70,90,60,80};
 
  sort(x,x+5,greater<int>());
  sort(y,y+4);
 
  for(int i=0;i<5;i++)
    cout<<x[i]<<" ";
 
  cout<<"\n";
 
  for(int j=0;j<4;j++)
   cout<<y[j]<<" ";
 
  cout<<"\n";
 
  return 0;
}
c_-_c_sorts/array_sort.txt · Last modified: 2020/07/15 10:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki