From d8853ff4ab889a4cf153ea851a2e5bbc4e732b37 Mon Sep 17 00:00:00 2001 From: Chetan Kaushik Date: Sat, 16 Jul 2016 16:38:05 +0530 Subject: [PATCH] Selection Sort --- SelectionSort.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 SelectionSort.cpp diff --git a/SelectionSort.cpp b/SelectionSort.cpp new file mode 100644 index 000000000..22d3fc5c7 --- /dev/null +++ b/SelectionSort.cpp @@ -0,0 +1,39 @@ +//Selection Sort + +#include +using namespace std; + +int main() +{ + int Array[6]; + cout<<"\nEnter any 6 Numbers for Unsorted Array : "; + + //Input + for(int i=0; i<6; i++) + { + cin>>Array[i]; + } + + //Selection Sorting + for(int i=0; i<6; i++) + { + int min=i; + for(int j=i+1; j<6; j++) + { + if(Array[j]