/** * blortsort.cpp * 30apr07/sklar * * this program demonstrates the blort sort algorithm. * */ #include #include #include using namespace std; // declare constants const int NUM_DICE = 5; // declare global variable int dice[NUM_DICE]; // declare function prototypes void initDice(); void printDice( int d[], int n ); void swapDice( int a, int b ); bool isSorted(); void permuteDice(); void blortSort(); /** * initDice() * * this function initializes the values in the array of dice to * integers between 1 and 6 * */ void initDice() { for ( int i=0; i dice[i+1] ) { anyErrors = true; } else { i++; } } // end while return( ! anyErrors ); } // end of isSorted() /** * permuteDice() * * this function "permutes" (mixes up) all the values in the dice array * */ void permuteDice() { int i, r; for ( i=0; i