best sorting algorithm c++ code example
Example: sorting algorithm c++
#include<iostream>
using namespace std;
int main(int argc, char const *argv[])
{
int numb[7];
int i, j;
for(i=0;i<=6;i++)
{
cout << "Enter a number" << endl;
cin >> numb[i];
}
for (i=0;i<=5;i++)
{
for (j=i+1;j<=5;j++)
{
int temp;
if (numb[i] > numb[j])
{
temp = numb[i];
numb[i] = numb[j];
numb[j] = temp;
}
}
}
for (i=0;i<=6;i++)
{
cout << endl << numb[i] << endl;
}
}