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

📄 general.cpp

📁 graphical implementation of linked list
💻 CPP
字号:

 /*************************************************************************/
 /*************************************************************************/
 /****************************  GENERAL.CPP  ******************************/
 /*************************************************************************/
 /*************************************************************************/

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

	  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  -----------------------------//
 /**************************************************************************/
 /**************************************************************************/

 /**************************************************************************/
 //---------------------------  User Defined  -----------------------------//
 /**************************************************************************/

 # include "Linklist.H"

 /*************************************************************************/
 /*************************************************************************/
 //----------------------  Function Definitions  -------------------------//
 /*************************************************************************/
 /*************************************************************************/

 /*************************************************************************/
 //-------------------- select_implementation_mode( )  -------------------//
 /*************************************************************************/

 void General::select_implementation_mode( )
    {
       delay(500);

       graphics.hilight_button(500,395,"Continue");

       int key_code_1=0;
       int key_code_2=0;
       int continue_exit=1;

       char key_1=NULL;
       char key_2=NULL;

       do
	  {
	     key_1=NULL;
	     key_2=NULL;

	     key_code_1=0;
	     key_code_2=0;

	     if(kbhit( ))
		{
		   key_1=getch( );
		   key_code_1=int(key_1);

		   if(key_code_1==0)
		      {
			 key_2=getch( );
			 key_code_2=int(key_2);
		      }
		}

	     if(key_code_1==0 && key_code_2==80)
		{
		   if(continue_exit==1)
		      {
			 graphics.hilight_button(500,395,"Continue",6);
			 graphics.hilight_button(500,430,"Exit    ");

			 continue_exit=2;
		      }

		   else if(continue_exit==2)
		      {
			 graphics.hilight_button(500,395,"Continue");
			 graphics.hilight_button(500,430,"Exit    ",6);

			 continue_exit=1;
		      }
		}

	     else if(key_code_1==0 && key_code_2==72)
		{
		   if(continue_exit==1)
		      {
			 graphics.hilight_button(500,395,"Continue",6);
			 graphics.hilight_button(500,430,"Exit    ");

			 continue_exit=2;
		      }

		    else if(continue_exit==2)
		      {
			 graphics.hilight_button(500,395,"Continue");
			 graphics.hilight_button(500,430,"Exit    ",6);

			 continue_exit=1;
		      }
		}
	  }
       while(key_code_1!=13);

       delay(500);

       graphics.hilight_button(500,395,"Continue",6);
       graphics.hilight_button(500,430,"Exit    ",6);

       delay(500);

       if(continue_exit==1)
	  graphics.show_selection_screen( );

       else if(continue_exit==2)
	  {
	     delay(500);
	     exit(0);
	  }

       delay(500);

       graphics.hilight_button(50,295," Stack  (Simple)    ");

       int implementation_mode=1;

       key_code_1=0;
       key_code_2=0;

       key_1=NULL;
       key_2=NULL;

       do
	  {
	     key_1=NULL;
	     key_2=NULL;

	     key_code_1=0;
	     key_code_2=0;

	     if(kbhit( ))
		{
		   key_1=getch( );
		   key_code_1=int(key_1);

		   if(key_code_1==0)
		      {
			 key_2=getch( );
			 key_code_2=int(key_2);
		      }
		}

	     if(key_code_1==0 && key_code_2==80)
		{
		   if(implementation_mode==1)
		      {
			 graphics.hilight_button(50,295,
						   " Stack  (Simple)    ",6);
			 graphics.hilight_button(50,370,
						     " Double Ended Stack ");

			 implementation_mode=2;
		      }

		   else if(implementation_mode==2)
		      {
			 graphics.hilight_button(50,370,
						   " Double Ended Stack ",6);
			 graphics.hilight_button(400,295,
						     " Queue  (Simple)    ");

			 implementation_mode=3;
		      }

		   else if(implementation_mode==3)
		      {
			 graphics.hilight_button(400,295,
						   " Queue  (Simple)    ",6);
			 graphics.hilight_button(400,370,
						     " Double Ended Queue ");

			 implementation_mode=4;
		      }
		   else if(implementation_mode==4)
		      {
			 graphics.hilight_button(400,370,
						   " Double Ended Queue ",6);
			 graphics.hilight_button(50,295,
						     " Stack  (Simple)    ");

			 implementation_mode=1;
		      }
		}

	     else if(key_code_1==0 && key_code_2==72)
		{
		   if(implementation_mode==1)
		      {
			 graphics.hilight_button(50,295,
						   " Stack  (Simple)    ",6);
			 graphics.hilight_button(400,370,
						     " Double Ended Queue ");

			 implementation_mode=4;
		      }

		    else if(implementation_mode==2)
		      {
			 graphics.hilight_button(50,295,
						     " Stack  (Simple)    ");
			 graphics.hilight_button(50,370,
						   " Double Ended Stack ",6);

			 implementation_mode=1;
		      }

		    else if(implementation_mode==3)
		      {
			 graphics.hilight_button(400,295,
						   " Queue  (Simple)    ",6);
			 graphics.hilight_button(50,370,
						     " Double Ended Stack ");

			 implementation_mode=2;
		      }

		    else if(implementation_mode==4)
		      {
			 graphics.hilight_button(400,295,
						     " Queue  (Simple)    ");
			 graphics.hilight_button(400,370,
						   " Double Ended Queue ",6);

			 implementation_mode=3;
		      }
		}
	  }
       while(key_code_1!=13);

       delay(500);

       graphics.hilight_button(50,295," Stack  (Simple)    ",6);
       graphics.hilight_button(50,370," Double Ended Stack ",6);
       graphics.hilight_button(400,295," Queue  (Simple)    ",6);
       graphics.hilight_button(400,370," Double Ended Queue ",6);

       delay(500);

       graphics.blink_linked_list( );

       if(implementation_mode==1)
	  stack.show_stack_working( );

       else if(implementation_mode==2)
	  de_stack.show_double_ended_stack_working( );

       else if(implementation_mode==3)
	  queue.show_queue_working( );

       else if(implementation_mode==4)
	  de_queue.show_double_ended_queue_working( );
    }

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

⌨️ 快捷键说明

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