0001 #include <stdio.h> 0002 0003 void print ( int A[], int n, int lo, int hi ) { //输出整数数组区间A[lo, hi) 0004 bool sorted = true; 0005 for ( int i = 1; i < n; i++ ) if ( A[i-1] > A[i] ) sorted = false; 0006 printf ( sorted ? "S: " : " : " ); 0007 for ( int i = 0; i < lo; i++ ) printf ( " ." ); 0008 for ( int i = lo; i < hi; i++ ) printf ( "%4d", A[i] ); 0009 for ( int i = hi; i < n; i++ ) printf ( " ." ); 0010 printf ( "\n" ); 0011 } 0012 0013 void print ( int A[], int n ) { print ( A, n, 0, n ); }