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

📄 sortview.h

📁 数据结构与算法的排序算法演示,这是我上大学的时候做的实验,里面展示了几种常用的排序算法的算法演示,如插入排序,选择排序,快速排序,堆排序.
💻 H
字号:
// SortView.h : interface of the CSortView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_SORTVIEW_H__870ABE38_EC0B_4BA2_BCAA_2E9B2B826392__INCLUDED_)
#define AFX_SORTVIEW_H__870ABE38_EC0B_4BA2_BCAA_2E9B2B826392__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CData
{
public:
	int key;
	CRect rt;
	COLORREF fillcolor;
	COLORREF textcolor;
	CData(){fillcolor=RGB(255,0,255);textcolor=RGB(0,0,255);}
	void SetColor(COLORREF fillcol,COLORREF textcol)
	{fillcolor=fillcol;textcolor=textcol;}
	void SetRect( int xLeft, int yTop, int xRight, int yBottom );
	void DrawFace(CDC* pDC);
};

class CSortView : public CView
{
private:
	CData* predata;
	CData* data;
	CData** pdata;
	CEdit m_edit1;
	CEdit m_edit2;
protected: // create from serialization only
	CSortView();
	DECLARE_DYNCREATE(CSortView)

// Attributes
public:
	int n;
	BOOL m_IsRun;
	CSortDoc* GetDocument();
    void AutoInput();
	void Show();
	void ReDraw(int i,int flag);
	void showij(int i,int j);
	void QuickPassShow(int i,int j,int flag);
	void HeapSortShow(int i,int j,int flag);
// Operations
public:
	void Delay(DWORD D);
	void InsertionSort();
	void SelectionSort();
	void BubbleSort();
	int QuickPass(int low,int high);//第一趟快速排序
	void QuickSort(int low,int high);//快速排序
	void Filter(int i,int n);
	void HeapSort(int n);
	void Merge(int a[],int T[],int low,int mid,int high);
	void MergePass(int a[],int T[],int length,int n);
	void MergeSort(int a[],int n);
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSortView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CSortView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CSortView)
	afx_msg void OnInsertionsort();
	afx_msg void OnBubblesort();
	afx_msg void OnSelectionsort();
	afx_msg void OnAutoinput();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnQuicksort();
	afx_msg void OnHeapinput();
	afx_msg void OnHeapsort();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in SortView.cpp
inline CSortDoc* CSortView::GetDocument()
   { return (CSortDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SORTVIEW_H__870ABE38_EC0B_4BA2_BCAA_2E9B2B826392__INCLUDED_)

⌨️ 快捷键说明

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