• 大小: 1.84MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-19
  • 语言: C/C++
  • 标签: 电梯程序  

资源简介

电梯控制程序的源代码文件,和用egg做得图形界面显示,界面美观

资源截图

代码片段和文件信息

#include“define.h“
#include“function.h“

int control(int state) //根据策略控制目标楼层 
{
   int nextno;
   switch(state)
   {
      case UP:
      { 
            nextno=findup();
            if(nextno==0)
            {
               nextno=finddown();
               if(nextno==0)
               {   state=FREE;
                    next=0;
               }
               else
               {
                   state=DOWN;//这里应该加个判断,判断是否应该覆盖
       listDOWN[nextno]=0;
                   next=nextno;
               }//找到以后将该项改为零
            }
           else 
           {  if(cover(nextnostate))      
              { listUP[nextno]=0;
                listup[next]=1;
                next=nextno;//找到以后将该项改为零  
               } 
               
           }
            break;   
        } 
            
     case DOWN:{  
          nextno=finddown();
          if(nextno==0)
          {
               nextno=findup();
               if(nextno==0)
                 { state=FREE;
                 next=0;
                 }
               else { state=UP;
                    listUP[nextno]=0;
                    next=nextno;
                     }
          }
          else 
          { if(cover(nextnostete))
             {
              listDOWN[next]=1;
              listDOWN[nextno]=0;
              next=nextno;
             }   
           }
         break;   
     } 
                 
    case FREE:
  {          if(nextno=findup());  
             state=UP;
             else if(nextno=finddown())
             state=DOWN;
             else
             state=FREE;
             break;
             }
    case STOP:
    {
         if(formerstate==UP) 
         {   
             nextno=findup();
             if(nextno==0)
             {
                  nextno=finddown();
                  if(nextno==0)
                  {  
                        state=FREE;
                        next=0;
                   }
                  else
                  {
                   state=DOWN;//这里应该加个判断,判断是否应该覆盖
       listdown[nextno]=0;
                   next=nextno;
                  }//找到以后将该项改为零
             }
            
              else 
              {  
                 if(cover(nextnostate))      
                 { 
                      listUP[nextno]=0;
                      listUP[next]=1;
                      next=nextno;//找到以后将该项改为零  
                  } 
               
               }
         }  
         else if(formerstate==DOWN) 
         {
               nextno=finddown();
               if(nextno==0)
               {
                   nextno=findup();
                   if(nextno==0)
                   { 
                      state=FREE;
                      next=0;
                    }
                   else 
                   { state=UP;
                       listUP[nextno]=0;
                       next=nextno;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-04-27 20:45  elevator_RC\
     文件        3834  2009-06-19 16:45  elevator_RC\1.bmp
     文件        3834  2009-06-19 16:45  elevator_RC\2.bmp
     文件        3834  2009-06-19 16:45  elevator_RC\3.bmp
     文件        3834  2009-06-19 16:45  elevator_RC\4.bmp
     文件        3834  2009-06-19 16:45  elevator_RC\5.bmp
     文件        3834  2009-06-19 16:45  elevator_RC\6.bmp
     文件        3834  2009-06-19 16:46  elevator_RC\7.bmp
     文件        3834  2009-06-19 16:46  elevator_RC\8.bmp
     文件        3834  2009-06-19 16:46  elevator_RC\9.bmp
     文件        3930  2009-06-11 02:51  elevator_RC\comtrol.c
     文件         720  2009-06-18 23:38  elevator_RC\configure.c
     文件           0  2009-06-11 02:31  elevator_RC\configure.h
     文件        1370  2009-06-19 21:10  elevator_RC\control.c
     文件         516  2009-06-11 02:51  elevator_RC\cover.c
     目录           0  2009-06-21 00:21  elevator_RC\Debug\
     文件        5454  2009-06-19 00:21  elevator_RC\Debug\configure.obj
     文件       12202  2009-06-19 21:22  elevator_RC\Debug\control.obj
     文件      262216  2009-06-19 21:26  elevator_RC\Debug\elevator.exe
     文件      392476  2009-06-19 21:26  elevator_RC\Debug\elevator.ilk
     文件     2812828  2009-06-19 21:26  elevator_RC\Debug\elevator.pch
     文件      803840  2009-06-19 21:26  elevator_RC\Debug\elevator.pdb
     文件       11934  2009-06-19 21:22  elevator_RC\Debug\ele_egg_output.obj
     文件       26536  2009-06-17 16:30  elevator_RC\Debug\ele_initialize.obj
     文件        3571  2009-06-19 21:22  elevator_RC\Debug\find.obj
     文件       14160  2009-06-19 21:22  elevator_RC\Debug\getInput.obj
     文件       15846  2009-06-19 21:22  elevator_RC\Debug\initialize.obj
     文件       13718  2009-06-19 21:22  elevator_RC\Debug\light_on_out.obj
     文件       12385  2009-06-19 21:22  elevator_RC\Debug\main.obj
     文件       14172  2009-06-19 21:26  elevator_RC\Debug\state_trans.obj
     文件       10573  2009-06-19 21:22  elevator_RC\Debug\time_count.obj
............此处省略39个文件信息

评论

共有 条评论