嗯 , 运行有错,看看吧,,,,
程序代码:
//按照一定的规则插入一个数字 #include < stdio.h > #include < stdlib.h > int main ( ) { int i, j, t, a[11] = { 1, 2, 3, 5, 6, 7, 8, 9, 10,11 }; scanf ( "%d", &t ); if ( t > a[9] ) a[10] = t; else { for ( i =0; i <10; i++ ) if ( a[i] > t ) for ( j=9; i <= j; j-- ) { a[j+1] = a[j]; a[i] = t; break; } } for ( i = 0; i<11; i++ ) { printf ( "%5d",a[i]); } system ( "pause" ); return 0; }运行不对