#include #include #include void bubble_sort(int a[],int n); using namespace std; int main( int argc, char *argv[] ) { int b[200],i=1,q; char a[200],*p; cout<<"輸入一字串,中間以空白隔開:"; gets(a); b[0]=atoi(strtok(a," ")); while((p=strtok(NULL," "))!=NULL) { b[i]=atoi(p); q=i; i++; } bubble_sort(b,q+1); cout<<"max="<a[j+1]) swap(a[j],a[j+1]); }