#include <the iostream>
the using namespace STD;
int main ()
{
int A [ 100 ]; // initialize an array
int n-; // initialize the array element number of variables
COUT << " Please enter the array element number of sorting: " << endl;
CIN >> n-;
// for array assignment
for ( int I = 0 ; I <n-; I ++ )
{
COUT << " Please enter " << I + . 1 << " value elements " <<endl;
CIN >> A [I];
}
// outer loop control to compare the number of rounds
// n--. 1 times
for ( int I = 0 ; I <n-- . 1 ; I ++ )
{
// within a control loop for each round comparison of the number of
// n--. 1 - I
for ( int J = 0 ; J <n-- . 1 - I; J ++) // the next successive number of times to reduce the ordering, see particularly FIG dynamic appreciated
{
IF (A [J]> A [+ J . 1 ]) // if the number is larger than the number in front of behind, to swap values of the number of
{
the swap (a [J], a [J +. 1 ]);
}
}
}
COUT << " sorted array is: " << endl;
for ( int I = 0 ; I <n-; I ++ )
{
COUT << A [I] << ' \ T ' ; // outputting the sorted array
}
}