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

📄 train3view.h

📁 在学习堆栈的应用时
💻 H
字号:
// train3View.h : interface of the CTrain3View class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_TRAIN3VIEW_H__507D4C6A_32C4_4E50_B723_E43298930923__INCLUDED_)
#define AFX_TRAIN3VIEW_H__507D4C6A_32C4_4E50_B723_E43298930923__INCLUDED_

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

#include"xcept.h"
class CTrain3View : public CView
{
protected: // create from serialization only
	CTrain3View();
	DECLARE_DYNCREATE(CTrain3View)

// Attributes
public:
	CTrain3Doc* GetDocument();
public:
	class queue
	{
	public:
		queue()
		{
			maxsize=11;
			a=new int[maxsize];
			front=rear=0;
		}
		~queue()
		{
			delete[]a;
		}
		queue& add(const int x)
		{
			if(IsFull()) throw NoMem();
			rear=(rear+1)%maxsize;
			a[rear]=x;
			return *this;
		}
		int get_last()
		{
			if(IsEmpty())
				throw OutOfBounds();
			return a[rear];
		}
		int get_first()
		{
			if(IsEmpty()) 
				throw OutOfBounds();
			return a[(front+1)%maxsize];
		}
		queue& Delete(int& x)
		{
			if(IsEmpty()) 
				throw OutOfBounds();
			front=(front+1)%maxsize;	
			x=a[front];
			return *this;
		}
		bool IsFull(){return front==(rear+1)%maxsize;}
	    bool IsEmpty(){return front==rear;}
	private:
		int *a;
	    int maxsize;
	    int front,rear;
	};
	bool Hold(int c,int& tt);
	bool Railroad();
	void Output();
private:
	int* count,*count2;
	int index;
	int jj;
    int	k;
	int n;
	int* ta;
	queue *Q;
	int minH;
	int minQ;


// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTrain3View)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

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

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CTrain3View)
	afx_msg void On1();
	afx_msg void On3();
	afx_msg void On2();
	afx_msg void On4();
	afx_msg void On5();
	afx_msg void On6();
	afx_msg void On7();
	afx_msg void On8();
	afx_msg void On9();
	afx_msg void OnStart();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in train3View.cpp
inline CTrain3Doc* CTrain3View::GetDocument()
   { return (CTrain3Doc*)m_pDocument; }
#endif

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

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

#endif // !defined(AFX_TRAIN3VIEW_H__507D4C6A_32C4_4E50_B723_E43298930923__INCLUDED_)

⌨️ 快捷键说明

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