// mystery.cpp // Part of queue example for 810:052 Data Structures class // Code by Mark Jacobson -- Wednesday, March 26, 1997 // Reformatted by Eugene Wallingford -- Thursday, March 27, 1997 #include #include // for log10 function void revealMystery(Queue & qNums, int divisor, int n) { cout << endl << "The list from the qNums queue after sorting on ----> pass " << log10(divisor) + 1 << " by " << divisor << "'s digit " << endl << endl; for (int i = 0; i < n; i++) { int x = qNums.dequeue(); cout << x << " "; qNums.enqueue(x); } cout << endl; int postSpaces = int( log10(divisor) ); int preSpaces = 3 - postSpaces; for (int i = 0; i < n; i++) { for (int j = 1; j <= preSpaces; j++) cout << " "; int y = qNums.dequeue(); cout << y / divisor % 10; qNums.enqueue(y); for (int k = 1; k <= postSpaces+1; k++) cout << " "; } cout << endl << endl; }