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

📄 linklist.h

📁 graphical implementation of linked list
💻 H
字号:

 /**************************************************************************/
 /**************************************************************************/
 //-------------------------  LinkList.H  ---------------------------------//
 /**************************************************************************/
 /**************************************************************************/

  /*************************************************************************

	  By :
		Muhammad Tahir Shahzad  [ MTS ]
		B.C.S Honours  [ 2000-04 ]
		Government College University Lahore
		Pakistan

      E-mail :  mtshome@wol.net.pk

    Web-Site :  www.mts-home.cjb.net  [ www.wol.net.pk/mtshome ]
		www.mtshome.cjb.net   [ www.geocities.com/mtahirshahzad ]

  *************************************************************************/

 /**************************************************************************/
 /**************************************************************************/
 //----------------------------  HEADER FILES  ----------------------------//
 /**************************************************************************/
 /**************************************************************************/

 # include <iostream.h>
 # include <graphics.h>
 # include   <string.h>
 # include   <stdlib.h>
 # include    <conio.h>
 # include      <dos.h>

 /**************************************************************************/
 /**************************************************************************/
 //---------------------------  CONSTANT VARIABLES  -----------------------//
 /**************************************************************************/
 /**************************************************************************/

 # define PUSH 0
 # define POP 1

 # define INSERT 0
 # define DELETE 1

 # define NORMAL 0
 # define WARNING 1

 # define IN 0
 # define OUT 1

 # define HORIZONTAL 0
 # define VERTICAL 1

 # define LEFT 0
 # define RIGHT 1

 # define SINGLE 0
 # define DOUBLE 1

 /**************************************************************************/
 /**************************************************************************/
 //----------------------  CLASS DEFINITION  ------------------------------//
 /**************************************************************************/
 /**************************************************************************/

 /**************************************************************************/
 //----------------------------  Graphics  --------------------------------//
 /**************************************************************************/

 class Graphics
       {
	  protected:
		char fill_pattern[8];

	  public:
		Graphics( );
		~Graphics( ) { }

		void draw_line(int,int,int,int,int,int);
		void draw_arc(int,int,int,int);
		void draw_button(int,int,char*);
		void hilight_button(int,int,char*,int=12);
		void show_main_screen( );
		void show_selection_screen( );
		void show_window(int,int,int,int);
		void blink_linked_list( );
		void waiting_for_input( );
		void show_stack_element_screen(int);
		void show_queue_element_screen(int);
		void clear_element_screen(int);
		void show_push_pop_screen(int);
		void show_insert_delete_screen(int);
		long get_element(int);
       };

 /**************************************************************************/
 //----------------------  Linked_list_Stack  -----------------------------//
 /**************************************************************************/

 class Linked_List_Stack:public Graphics
	{
	   private:
		int pushed_element_count;

		struct node
			{
			   long data;
			   node *next;
			};

		node *top;
		node *entry;
		node *print;
		node *bottom;
		node *last_entry;
		node *second_last_entry;

	   public:
		Linked_List_Stack( );

		void pop( );
		void push( );
		void print_stack( );
		void show_stack_working( );
		void show_stack_screen( );
		void show_stack_output_screen( );
	};

 /**************************************************************************/
 //----------------------  Linked_list_Queue  -----------------------------//
 /**************************************************************************/

 class Linked_List_Queue:public Graphics
	{
	   private:
		int inserted_element_count;

		struct node
			{
			   long data;
			   node *next;
			};

		node *rear;
		node *entry;
		node *print;
		node *front;

	   public:
		Linked_List_Queue( );

		void Delete( );
		void Insert( );
		void print_queue( );
		void show_queue_working( );
		void show_queue_screen( );
		void show_queue_output_screen( );
	};

 /**************************************************************************/
 //---------------------------  Linked_list  ------------------------------//
 /**************************************************************************/

 class Double_Ended_Linked_List_Stack:public Graphics
	{
	   private:
		int pushed_element_count;

		struct node
			{
			   long data;
			   node *next;
			   node *previous;
			};

		node *top;
		node *entry;
		node *print;
		node *bottom;

	   public:
		Double_Ended_Linked_List_Stack();
		void pop( );
		void push( );
		void print_double_ended_stack( );
		void show_double_ended_stack_working( );
		void show_double_ended_stack_screen( );
		void show_double_ended_stack_output_screen( );

	};

 /**************************************************************************/
 //---------------------------  Linked_list  ------------------------------//
 /**************************************************************************/

 class Double_Ended_Linked_List_Queue:public Graphics
	{
	   private:
		int inserted_element_count;

		struct node
			{
			   long data;
			   node *next;
			   node *previous;
			};

		node *rear;
		node *entry;
		node *print;
		node *front;

	   public:
		Double_Ended_Linked_List_Queue( );

		void Delete( );
		void Insert( );
		void print_double_ended_queue( );
		void show_double_ended_queue_working( );
		void show_double_ended_queue_screen( );
		void show_double_ended_queue_output_screen( );
    };

 /**************************************************************************/
 //-----------------------------  General  --------------------------------//
 /**************************************************************************/

 class General
       {
	  private:
		Graphics  graphics;
		Linked_List_Stack  stack;
		Linked_List_Queue  queue;
		Double_Ended_Linked_List_Stack  de_stack;
		Double_Ended_Linked_List_Queue  de_queue;

	  public:
		General( ) { }
		~General( ) { }

		void select_implementation_mode( );
       };

 /**************************************************************************/
 /**************************************************************************/
 //------------------------------  THE END  -------------------------------//
 /**************************************************************************/
 /**************************************************************************/

⌨️ 快捷键说明

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