📄 bubblesort.cpp
字号:
#include "StdAfx.h"
#include ".\bubblesort.h"
CBubbleSort::CBubbleSort(void)
{
}
CBubbleSort::~CBubbleSort(void)
{
}
void CBubbleSort::Sort(int* pData, int nLen)
{
int i;
int nTemp;
BOOL bSwap;
bSwap = TRUE;
while(bSwap){
bSwap = FALSE;
for(i=0;i<nLen-1;i++){
if(pData[i]>pData[i+1]){
//交换数据
nTemp = pData[i];
pData[i] = pData[i+1];
pData[i+1] = nTemp;
bSwap = TRUE;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -