# include // // In this example, we know the values of A, B, and C, and we // just want to move them around so they are in order. // int main ( ) { int a = 3; int b = 1; int c = 2; int t; // // If we want A, B, and C to be in order, we need to swap entries. // To do this, we need a helper variable "T" to temporarily store one value. // // Here's the first swap: // // A B C T // - - - - // 3 1 2 // 3 1 2 1 // 3 3 2 1 // 1 3 2 1 // t = b; b = a; a = t; // // Here's the second swap: // // A B C T // - - - - // 1 3 2 3 // 1 2 2 3 // 1 2 3 3 // t = b; b = c; c = t; // // Now A, B and C are sorted. // return 0; }