标签:style blog color os io for div log sp
1 #include <iostream> 2 using namespace std; 3 int BubbleSort(int A[],int n); 4 int OutPut(int A[],int n); 5 int main() 6 { 7 int A[]={5,1,3,2,4}; 8 BubbleSort(A,5); 9 OutPut(A,5); 10 return 0; 11 } 12 13 int BubbleSort(int A[],int n) 14 { 15 for(int i=0;i<n-1;i++) 16 { 17 for(int j=i+1;j<n;j++) 18 { 19 if(A[i]>A[j]) 20 { 21 int temp=A[i]; 22 A[i]=A[j]; 23 A[j]=temp; 24 } 25 } 26 } 27 return 0; 28 } 29 30 int OutPut(int A[],int n) 31 { 32 for(int i=0;i<n;i++) 33 { 34 cout<<A[i]<<‘\n‘; 35 } 36 return 0; 37 }
标签:style blog color os io for div log sp
原文地址:http://www.cnblogs.com/niuxiaoha/p/3951403.html