sorting of array in c++
C++
// C++ program to demonstrate default behaviour of
// sort() in STL.
#include <bits/stdc++.h>
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;
}
sort(arr, arr+n, greater<int>()); // sorts in descending ordersort(arr, arr+n);
sort(arr, arr+n, greater<int>()); // In Descending Order
Also in C++:
- Title
- how to iterate over unordered_map c++
- Category
- C++
- Title
- c++ evaluate expression
- Category
- C++
- Title
- c++ ambigous error
- Category
- C++
- Title
- c++ random
- Category
- C++
- Title
- how to get last element of set in c++
- Category
- C++
- Title
- time conversion hackerrank solution in c++
- Category
- C++
- Title
- sort function in cpp
- Category
- C++
- Title
- graph using djacency matrix c++
- Category
- C++
- Title
- how to get a letter from the user c++ string
- Category
- C++
- Title
- c++ overload operator
- Category
- C++
- Title
- how to make a switch case statement in c++
- Category
- C++
- Title
- visual studio 2019 read and write text file c++
- Category
- C++
- Title
- Get handle in C++
- Category
- C++
- Title
- floor() in c++
- Category
- C++
- Title
- COnvert string to char * C++
- Category
- C++
- Title
- c++ unittest in ros
- Category
- C++
- Title
- initialising 2d vector
- Category
- C++
- Title
- iterative preorder traversal
- Category
- C++
- Title
- program to know if a number is prime
- Category
- C++
- Title
- how to convert n space separated integers in c++
- Category
- C++
- Title
- basic ex of maps in c++
- Category
- C++
- Title
- c++ how to return an empty vector
- Category
- C++
- Title
- min and max heap in cpp
- Category
- C++
- Title
- how to concatinate two strings in c++
- Category
- C++
- Title
- error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if(s[i] != "b"){
- Category
- C++
- Title
- statement that causes a function to end in c++
- Category
- C++
- Title
- multiset c++
- Category
- C++
- Title
- 1d fixed length arrays c++
- Category
- C++
- Title
- convert int to binary string c++
- Category
- C++
- Title
- arrow operator c++
- Category
- C++
- Title
- Runtime Error: Runtime ErrorAbort signal from abort(3) (SIGABRT)
- Category
- C++
- Title
- Html tabulation
- Category
- C++
- Title
- c++ variable argument
- Category
- C++
- Title
- c++ code for polynomial addition
- Category
- C++
- Title
- C++ and endl
- Category
- C++
- Title
- c++ isalphanum
- Category
- C++
- Title
- cpp loop through object
- Category
- C++
- Title
- modular exponentiation c++
- Category
- C++
- Title
- class is replace by structure
- Category
- C++
- Title
- cube mapping sdl
- Category
- C++
- Title
- least number of coins to form a sum
- Category
- C++
- Title
- time function c++
- Category
- C++
- Title
- transpose matrix eigen c++
- Category
- C++
- Title
- ue4 c++ overlapping functions cpp setup
- Category
- C++
- Title
- double max value c++
- Category
- C++
- Title
- set of vectors c++
- Category
- C++
- Title
- self in c++
- Category
- C++
- Title
- call by reference c++ example
- Category
- C++
- Title
- never gonna give you up lyrics
- Category
- C++
- Title
- run program until ctrl-d c++
- Category
- C++
- Title
- c++ sort vector of objects by property
- Category
- C++
- Title
- loop through array c++
- Category
- C++
- Title
- inserting an element in an set c++
- Category
- C++
- Title
- new in c++
- Category
- C++
- Title
- How to read a file in in C++
- Category
- C++
- Title
- add a timer c++
- Category
- C++
- Title
- how to run c++ file mingw cmd
- Category
- C++
- Title
- c++ program for matrix addition
- Category
- C++
- Title
- what is order in of preeendence in float, int, char, bool
- Category
- C++
- Title
- nth_element c++
- Category
- C++
- Title
- screen record ios simulator
- Category
- C++
- Title
- c++ how to skip the last element of vector
- Category
- C++
- Title
- intersection between vector c++
- Category
- C++
- Title
- fail() in c++
- Category
- C++
- Title
- split 2d array into chunks in c++
- Category
- C++
- Title
- how to execute c++ program in cmd
- Category
- C++
- Title
- C++ string format ctime
- Category
- C++
- Title
- arrays in C++
- Category
- C++
- Title
- log base 10 c+_+
- Category
- C++
- Title
- length of string in c++
- Category
- C++
- Title
- else if c++
- Category
- C++
- Title
- c++ pointers
- Category
- C++
- Title
- kruskal's algorithm c++ hackerearth
- Category
- C++
- Title
- primeros numeors primos menores que
- Category
- C++
- Title
- double to int c++
- Category
- C++
- Title
- centos7 mlock2
- Category
- C++
- Title
- convert integer to string c++
- Category
- C++
- Title
- stringstream in c++ with delimiter
- Category
- C++
- Title
- C++ remove element from set
- Category
- C++
- Title
- c++ program to find gcd of 3 numbers
- Category
- C++
- Title
- mingw32/bin/ld.exe: C:\Users\mfrom\AppData\Local\Temp\ccSKcRks.o:PizzaPi.cpp:(.text$_ZN5PizzaC2Ev[__ZN5PizzaC2Ev]+0xa): undefined reference to `vtable for Pizza' collect2.exe: error: ld returned 1 exit status
- Category
- C++
- Title
- count function c++
- Category
- C++
- Title
- c++ compiler for sublime text
- Category
- C++
- Title
- c++ vector iterator
- Category
- C++
- Title
- c++ function return array
- Category
- C++
- Title
- c++ code to print hello world
- Category
- C++
- Title
- find height of a tree
- Category
- C++
- Title
- declaring 2d vector in c++
- Category
- C++
- Title
- getch c++ library
- Category
- C++
- Title
- popualte an array c++
- Category
- C++
- Title
- google pdf iframe viwer
- Category
- C++
- Title
- kruskal c++
- Category
- C++
- Title
- c++ pi
- Category
- C++
- Title
- private and public in namespace cpp
- Category
- C++
- Title
- strchr function in c++
- Category
- C++
- Title
- bfs in C++
- Category
- C++
- Title
- c++ method name
- Category
- C++
- Title
- converting char to int in c++
- Category
- C++
- Title
- multiple words C++ in same
- Category
- C++
- Title
- c++ convert int to double
- Category
- C++