⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sort.cpp

📁 关于书籍《Borland c++Builder工程实践》的源代码
💻 CPP
字号:
//---------------------------------------------------------------------------

#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -