基础知识复习。
#include #define N 100void Maopao_num(int A[],int low,int high);int main() {int String[N];int i=0;printf("请输入数组String:n(以-1结束)");while(String[i-1]!=-1){scanf("%d",&String[i]);i++;}i=i-2;int low_1=0,high_1=i;Maopao_num(String,low_1,high_1);printf("n冒泡排序后数组为:n");for(int m=0;m<=i;m++){printf("%d ",String[m]);}return 0;} void Maopao_num(int A[],int low,int high){int temp;for(int k=high;k>low;k--){for(int j=0;jA[j+1]){temp=A[j];A[j]=A[j+1];A[j+1]=temp;}}}}
运行结果为: