sortstringarray.cpp
来自「最适合在学校成批地建立删除学生用户或学生文件夹」· C++ 代码 · 共 51 行
CPP
51 行
// SortStringArray.cpp: implementation of the CSortStringArray class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "UMIB.h"
#include "SortStringArray.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CSortStringArray::CSortStringArray()
{
}
CSortStringArray::~CSortStringArray()
{
}
void CSortStringArray::Sort()
{
BOOL bNotDone = TRUE;
int nPrevious = 0;
int nNext=0;
CString strTemp;
while (bNotDone)
{
bNotDone = FALSE;
for(;nPrevious < GetUpperBound();++nPrevious)
{
nNext=nPrevious+1;
if (GetAt(nPrevious).CompareNoCase(GetAt(nNext)) > 0)
{
strTemp = GetAt(nPrevious);
SetAt(nPrevious, GetAt(nNext));
SetAt(nNext, strTemp);
bNotDone=TRUE;
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?