mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-12 15:05:47 +08:00
formatting source-code for 153fb7b8a5
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
int n;
|
||||
std::cout << "\nEnter the length of your array : ";
|
||||
std::cin >> n;
|
||||
@@ -11,18 +10,15 @@ int main()
|
||||
std::cout << "\nEnter any " << n << " Numbers for Unsorted Array : ";
|
||||
|
||||
// Input
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
for (int i = 0; i < n; i++) {
|
||||
std::cin >> Array[i];
|
||||
}
|
||||
|
||||
// Sorting
|
||||
for (int i = 1; i < n; i++)
|
||||
{
|
||||
for (int i = 1; i < n; i++) {
|
||||
int temp = Array[i];
|
||||
int j = i - 1;
|
||||
while (j >= 0 && temp < Array[j])
|
||||
{
|
||||
while (j >= 0 && temp < Array[j]) {
|
||||
Array[j + 1] = Array[j];
|
||||
j--;
|
||||
}
|
||||
@@ -31,8 +27,7 @@ int main()
|
||||
|
||||
// Output
|
||||
std::cout << "\nSorted Array : ";
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
for (int i = 0; i < n; i++) {
|
||||
std::cout << Array[i] << "\t";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user