# Definition number 10
Structure data {int valueint seat} D[NUM], Dtmp
void main()
{
int i,j,k;
Printf ("Enter %d integers:", num);
for(I = 0; I & ltNUMD[i]. seat=i++)scanf("%d ",& ampD[i]。 Value);
Printf ("Original data order: \n")
for(I = 0; I & ltNUMi++) printf("%d ",D[i]. Value);
for(I = 0; I< numi++)//I < NUM = = & gtwri & LTE it as I < num-1doesn't improve much efficiency, because the last inner loop is 0 steps, so write Num directly, which saves the trouble of programming.
for(j = 0; j & ltNUM- 1-I; J++)// Simple is to bubble directly. For a few orders of magnitude, the efficiency of simple algorithm is not much different from that of advanced algorithm.
If(D[j]. Value & gtD[j+ 1]. Value)
{
Dtmp.value = D[j]。 Value; D[j]。 value=D[j+ 1]。 Value; D[j+ 1]。 value = Dtmp.value
Dtmp.seat = D[j]。 Seats; D[j]。 seat=D[j+ 1]。 Seats; D[j+ 1]。 seat = Dtmp.seat
}
Printf ("sort data: \ n");
for(I = 0; I & ltNUMi++) printf("%d[%d] ",D[i]. Value, D[i]. Seats);
}