标签:i++ [] c++实现 冒泡排序 ++ for 比较 ott eof
def BubbleSort(): Array = [1,4,6,8,3] for i in range(len(Array)-1): for j in range(len(Array)-i-1): if Array[j]>Array[j+1]: #两两比较,谁小放前面 Array[j],Array[j+1] = Array[j+1],Array[j
int v1[] = { 1,4,7,2,8,4,5 }; int Temp = 0; int Length = (sizeof(v1) / sizeof(int)); int i = 0; int j = 1; for (i; i < Length; i++) { for (j = i + 1; j < Length; j++) { if (v1[i] > v1[j]) { Temp = v1[i]; v1[i] = v1[j]; v1[j] = Temp; } } } for (i = 0; i < Length; i++) { printf("%d\r\n", v1[i]); }
标签:i++ [] c++实现 冒泡排序 ++ for 比较 ott eof
原文地址:http://www.cnblogs.com/w1ng/p/6623366.html