sortthd.h

来自「C++ Builder 6 编程实例教程-北京希望电子出版社出版」· C头文件 代码 · 共 68 行

H
68
字号
//----------------------------------------------------------------------------
//Borland C++Builder
//Copyright (c) 1987, 1998-2002 Borland International Inc. All Rights Reserved.
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
#ifndef SortThdH
#define SortThdH
//----------------------------------------------------------------------------
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include <Classes.hpp>
#include <System.hpp>
//----------------------------------------------------------------------------
extern void __fastcall PaintLine(TCanvas *Canvas, int i, int len);
//----------------------------------------------------------------------------
class TSortThread : public TThread
{
private: 
	TPaintBox *FBox;
	int *FSortArray;
	int FSize;
	int FA;
	int FB;
	int FI;
	int FJ;
	void __fastcall DoVisualSwap(void);
	
protected:
	virtual void __fastcall Execute(void);
	void __fastcall VisualSwap(int A, int B, int I, int J);
	virtual void __fastcall Sort(int *A, const int A_Size) = 0;
	
public:
	__fastcall TSortThread(TPaintBox *Box, int *SortArray, 
	    const int SortArray_Size);
};
//----------------------------------------------------------------------------
class TBubbleSort : public TSortThread
{
protected:
	virtual void __fastcall Sort(int *A, const int A_Size);
public:
	__fastcall TBubbleSort(TPaintBox *Box, int *SortArray, 
	    const int SortArray_Size);
};
//----------------------------------------------------------------------------
class TSelectionSort : public TSortThread
{
protected:
	virtual void __fastcall Sort(int *A, const int A_Size);
public:
	__fastcall TSelectionSort(TPaintBox *Box, int *SortArray, 
	    const int SortArray_Size);
};
//----------------------------------------------------------------------------
class TQuickSort : public TSortThread
{
protected:
	void __fastcall QuickSort(int *A, const int A_Size, int iLo, 
	  int iHi);
	virtual void __fastcall Sort(int *A, const int A_Size);
public:
	__fastcall TQuickSort(TPaintBox *Box, int *SortArray, 
	    const int SortArray_Size);
};
//----------------------------------------------------------------------------
#endif	

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?