From df74e656a2b5cc327f6423d4c1518a30ea15e2ab Mon Sep 17 00:00:00 2001 From: Piyush Date: Tue, 2 Oct 2018 23:16:58 +0530 Subject: [PATCH] add: sort technique using vectors --- imp_fun.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 imp_fun.cpp diff --git a/imp_fun.cpp b/imp_fun.cpp new file mode 100644 index 000000000..e0a70eeda --- /dev/null +++ b/imp_fun.cpp @@ -0,0 +1,45 @@ +// A C++ program to demonstrate working of sort(), +// reverse() +#include +#include +#include +#include //For accumulate operation +using namespace std; + +int main() +{ + // Initializing vector with array values + int arr[] = {10, 20, 5, 23 ,42 , 15}; + int n = sizeof(arr)/sizeof(arr[0]); + vector vect(arr, arr+n); + + cout << "Vector is: "; + for (int i=0; i