From 0c8bdfd4f8be7e3f96c45127bf67396138217c72 Mon Sep 17 00:00:00 2001 From: harjot3200 Date: Sun, 1 Oct 2017 11:15:00 +0530 Subject: [PATCH] Add files via upload --- sorting_a_vector.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 sorting_a_vector.cpp diff --git a/sorting_a_vector.cpp b/sorting_a_vector.cpp new file mode 100644 index 00000000..39eba6a8 --- /dev/null +++ b/sorting_a_vector.cpp @@ -0,0 +1,40 @@ +#include +#include +#include +#include +using namespace std; + +bool compare(int a,int b){ + return a>b; +} + +int main(){ + + vector v; + + for(int i=1;i<5;i++){ + v.push_back(i); + } + int p; + cin>>p; + + int d; + cin>>d; + + v.insert(v.begin() + p,d); + + for(int i=0;i