冒泡排序法
摘要:
//代码 在vc6.0上面编译通过#include <iostream>using namespace std;void BubbleSort(int arr[], int n){int i=0,j=0; for(i=0;i<n;i++){for(j=0;j<n-1-i;j++){if(arr[j]>arr[j+1]){int temp;temp = arr[j];arr[j] = arr[j+1];arr[j+1] = temp;} } }}int main(){int a[] = {4,2,9,5,8};for (int i=0;i<5;i++){cou 阅读全文
posted @ 2013-06-07 17:32 小彭屋 阅读(125) 评论(0) 推荐(0)
浙公网安备 33010602011771号