style: format code

This commit is contained in:
yanglbme
2019-08-21 10:10:08 +08:00
parent abc0d365de
commit 69ddc9fc52
101 changed files with 3154 additions and 2984 deletions

View File

@@ -1,39 +1,39 @@
//Selection Sort
#include<iostream>
#include <iostream>
using namespace std;
int main()
{
int Array[6];
cout<<"\nEnter any 6 Numbers for Unsorted Array : ";
cout << "\nEnter any 6 Numbers for Unsorted Array : ";
//Input
for(int i=0; i<6; i++)
for (int i = 0; i < 6; i++)
{
cin>>Array[i];
cin >> Array[i];
}
//Selection Sorting
for(int i=0; i<6; i++)
for (int i = 0; i < 6; i++)
{
int min=i;
for(int j=i+1; j<6; j++)
int min = i;
for (int j = i + 1; j < 6; j++)
{
if(Array[j]<Array[min])
if (Array[j] < Array[min])
{
min=j; //Finding the smallest number in Array
min = j; //Finding the smallest number in Array
}
}
int temp =Array[i];
Array[i]=Array[min];
Array[min]=temp;
int temp = Array[i];
Array[i] = Array[min];
Array[min] = temp;
}
//Output
cout<<"\nSorted Array : ";
for(int i=0; i<6; i++)
cout << "\nSorted Array : ";
for (int i = 0; i < 6; i++)
{
cout<<Array[i]<<"\t";
cout << Array[i] << "\t";
}
}