From 7d5892b5a090d5a35994614ed065132fee803003 Mon Sep 17 00:00:00 2001 From: Roshan Kumar Date: Sun, 17 Jan 2021 16:17:57 +0530 Subject: [PATCH] Added selection sorting algorithm --- sorting/c-or-cpp/selection-sort.cpp | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 sorting/c-or-cpp/selection-sort.cpp diff --git a/sorting/c-or-cpp/selection-sort.cpp b/sorting/c-or-cpp/selection-sort.cpp new file mode 100644 index 00000000..629f0eb2 --- /dev/null +++ b/sorting/c-or-cpp/selection-sort.cpp @@ -0,0 +1,33 @@ +# include +using namespace std; + +int main(int argc, char const *argv[]) +{ // length of array + cout<<"Enter the length of array"<>n; + int arr[n]; + // Getting elements of array + cout<<"Enter the elements of array"<>arr[i]; + } + for (int i = 0; i < n; i++) + { + for(int j = i; j