sort.cpp
来自「关于书籍《Borland c++Builder工程实践》的源代码」· C++ 代码 · 共 70 行
CPP
70 行
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Sort.h"
#include "BubbleSort.h"
#include "InsertSort.h"
#include "SelectSort.h"
#pragma package(smart_init)
//---------------------------------------------------------------------------
// Important: Methods and properties of objects in VCL can only be
// used in a method called using Synchronize, for example:
//
// Synchronize(UpdateCaption);
//
// where UpdateCaption could look like:
//
// void __fastcall Sort::UpdateCaption()
// {
// Form1->Caption = "Updated in a thread";
// }
//---------------------------------------------------------------------------
__fastcall Sort::Sort(int i,bool CreateSuspended)
: TThread(CreateSuspended)
{
switch (i)
{
case 1:
SortFlag = BubSort;
break;
case 2:
SortFlag = SelSort;
break;
case 3:
SortFlag = InsSort;
break;
default:
SortFlag = BubSort;
break;
}
}
//---------------------------------------------------------------------------
void __fastcall Sort::Execute()
{
switch(SortFlag)
{
case BubSort:
BubForm->Run();
BubForm->Close();
break;
case SelSort:
SelForm->Run();
SelForm->Close();
break;
case InsSort:
InsForm->Run();
InsForm->Close();
break;
default:
BubForm->Run();
BubForm->Close();
break;
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?