亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? elev.cpp

?? 很好的一個(gè)C++控制臺(tái)程序
?? CPP
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
   bool destins_above, destins_below;    //destinations
   bool requests_above, requests_below;  //requests
   //floor number of closest request above us and below us
   int nearest_higher_req = 0;
   int nearest_lower_req = 0;
   //flags indicate if there is another car, going in the same
   //direction, between us and the nearest floor request (FR)
   bool car_between_up, car_between_dn;
   //flags indicate if there is another car, going in the
   //opposite direction, on the opposite side of the nearest FR
   bool car_opposite_up, car_opposite_dn;
   //floor and direction of other car (not us)
   int ofloor;                          //floor
   direction odir;                      //direction

   //ensure we don't go too high or too low
   if( (current_floor==NUM_FLOORS-1 && current_dir==UP)
      || (current_floor==0 && current_dir==DN) )
      current_dir = STOP;

   //if there's a destination on this floor, unload passengers
   if( destination[current_floor]==true )
   {
      destination[current_floor] = false;  //erase destination
      if( !unloading_timer)                //unload
         unloading_timer = LOAD_TIME;
      return;
   }
   //if there's an UP floor request on this floor,
   //and if we're going up or stopped, load passengers
   if( (ptrBuilding->get_floor_req(UP, current_floor) && 
        current_dir != DN) )
   {
      current_dir = UP;  //(in case it was STOP)
      //remove floor request for direction we're going
      ptrBuilding->set_floor_req(current_dir, 
                                 current_floor, false);
      if( !loading_timer)                  //load
         loading_timer = LOAD_TIME;
      return;
   }
   //if there's a down floor request on this floor,
   //and if we're going down or stopped, load passengers
   if( (ptrBuilding->get_floor_req(DN, current_floor) && 
        current_dir != UP) )
   {
      current_dir = DN;  //(in case it was STOP)
      //remove floor request for direction we're going
      ptrBuilding->set_floor_req(current_dir,
                                  current_floor, false);
      if( !loading_timer)                  //load passengers
         loading_timer = LOAD_TIME;
      return;
   }
   //check if there are other destinations or requests
   //record distance to nearest request
   destins_above = destins_below = false;
   requests_above = requests_below = false;
   for(j=current_floor+1; j<NUM_FLOORS; j++)
   {                                   //check floors above
      if( destination[j] )                //if destinations
         destins_above = true;            //set flag
      if( ptrBuilding->get_floor_req(UP, j) || 
          ptrBuilding->get_floor_req(DN, j) )
      {                                //if requests
         requests_above = true;           //set flag
         if( !nearest_higher_req )        //if not set before
            nearest_higher_req = j;       //   set nearest req
      }
   }
   for(j=current_floor-1; j>=0; j--)      //check floors below
   {
      if(destination[j] )                 //if destinations
         destins_below = true;            //set flag
      if( ptrBuilding->get_floor_req(UP, j) || 
          ptrBuilding->get_floor_req(DN, j) )
      {                                //if requests
         requests_below = true;           //set flag
         if( !nearest_lower_req )         //if not set before
            nearest_lower_req = j;        //   set nearest req
      }
   }
   //if no requests or destinations above or below, stop
   if( !destins_above && !requests_above &&
       !destins_below && !requests_below)
    {
       current_dir = STOP;
       return;
    }
   //if destinations and we're stopped, or already going the
   //right way, go toward destinations
   if( destins_above && (current_dir==STOP || current_dir==UP) )
   {
      current_dir = UP;
      return;
   }
   if( destins_below && (current_dir==STOP || current_dir==DN) )
   {
      current_dir = DN;
      return;
   }
   //find out if there are other cars, (a) going in the same
   //direction, between us and the nearest floor request;
   //or (b) going in the opposite direction, on the other
   //side of the floor request
   car_between_up = car_between_dn = false;
   car_opposite_up = car_opposite_dn = false;

      if(car_number != 0)                 //if it's not us
      {                                //get its floor
         ofloor = ptrBuilding->get_cars_floor();   //and
         odir = ptrBuilding->get_cars_dir(); //direction

         //if it's going up and there are requests above us
         if( (odir==UP || odir==STOP) && requests_above )
            //if it's above us and below the nearest request
            if( (ofloor > current_floor
                && ofloor <= nearest_higher_req)
            //or on same floor as us but is lower car number
              || (ofloor==current_floor &&  car_number >0) )
               car_between_up = true;
         //if it's going down and there are requests below us
         if( (odir==DN || odir==STOP) && requests_below )
            //if it's below us and above the nearest request
            if( (ofloor < current_floor
                && ofloor >= nearest_lower_req)
               //or on same floor as us but is lower car number
               || (ofloor==current_floor && car_number >0) )
               car_between_dn = true;
         //if it's going up and there are requests below us
         if( (odir==UP || odir==STOP) && requests_below )
            //it's below request and closer to it than we are
            if(nearest_lower_req >= ofloor
               && nearest_lower_req - ofloor
                  < current_floor - nearest_lower_req)
               car_opposite_up = true;
         //if it's going down and there are requests above us
         if( (odir==DN || odir==STOP) && requests_above )
            //it's above request and closer to it than we are
            if(ofloor >= nearest_higher_req
               && ofloor - nearest_higher_req
                  < nearest_higher_req - current_floor)
               car_opposite_dn = true;
      }  //end if(not us)
   //if we're going up or stopped, and there is an FR above us,
   //and there are no other cars going up between us and the FR,
   //or above the FR going down and closer than we are,
   //then go up
   if( (current_dir==UP || current_dir==STOP)
       && requests_above && !car_between_up && !car_opposite_dn )
   {
      current_dir = UP;
      return;
   }

   //if we're going down or stopped, and there is an FR below
   //us, and there are no other cars going down between us and
   //the FR, or below the FR going up and closer than we are,
   //then go down
   if( (current_dir==DN || current_dir==STOP)
       && requests_below && !car_between_dn && !car_opposite_up )
   {
      current_dir = DN;
      return;
   }
   //if nothing else happening, stop
   current_dir = STOP;
}  //end decide(), finally
//--------------------------------------------------------------
void elevator::move() 
{                          //if loading or unloading,
   if(loading_timer || unloading_timer)  //don't move
      return;
   if(current_dir==UP)        //if going up, go up
      current_floor++;
   else if(current_dir==DN)   //if going down, go down
      current_floor--;
}  //end move()
//--------------------------------------------------------------
void elevator::get_destinations()     //stop, get destinations
{
   char ustring[BUF_LENGTH];          //utility buffer for input
   int dest_floor;                    //destination floor

   set_cursor_pos(1,22); clear_line();  //clear top line
   set_cursor_pos(1, 22);
   cout << "Car 1"  
        << " has stopped at floor " << (current_floor+1)
        << "\nEnter destination floors (0 when finished)";
   for(int j=1; j<NUM_FLOORS; j++)    //get floor requests
   {                               //maximum; usually fewer
      set_cursor_pos(1, 24);
      cout << "Destination " << j << ": ";

      cin.get(ustring, BUF_LENGTH);   //(avoid multiple LFs)
      cin.ignore(10, '\n');      //eat chars, including newline
      dest_floor = atoi(ustring);
      set_cursor_pos(1,24); clear_line(); //clear old input line
      if(dest_floor==0)               //if no more requests,
      {                            //clear bottom three lines
         set_cursor_pos(1,22); clear_line();      
         set_cursor_pos(1,23); clear_line();
         set_cursor_pos(1,24); clear_line();
         return;
      }
      --dest_floor;                   //start at 0, not 1
      if(dest_floor==current_floor)   //chose this very floor
      { --j; continue; }           //   so forget it
      //if we're stopped, first choice made sets direction
      if(j==1 && current_dir==STOP)
         current_dir = (dest_floor < current_floor) ? DN : UP;
      destination[dest_floor] = true; //record selection
      dests_display();                //display destinations
   }
}  //end get_destinations()
//--------------------------------------------------------------

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日韩高清在线| 日韩一区二区视频| 成人免费在线视频观看| 不卡电影免费在线播放一区| 国产亚洲一本大道中文在线| 国产麻豆视频精品| 国产精品成人免费| 在线观看国产精品网站| 午夜国产精品一区| 欧美成人精品1314www| 成人综合在线网站| 一区二区在线免费观看| 欧美精品日韩综合在线| 国内精品写真在线观看| 亚洲欧美综合在线精品| 欧美日韩精品专区| 国产乱码精品一区二区三| 日本一区二区久久| 色婷婷久久久久swag精品| 天天操天天综合网| 国产免费观看久久| 欧美色偷偷大香| 国产一区二区看久久| 亚洲视频精选在线| 日韩视频免费观看高清完整版| 国产精品一区二区三区四区| 亚洲女人****多毛耸耸8| 日韩一级完整毛片| 99精品欧美一区| 美腿丝袜在线亚洲一区| 国产精品天干天干在观线| 欧美日韩一本到| 丁香婷婷综合网| 天堂va蜜桃一区二区三区漫画版| 久久久精品一品道一区| 欧美人伦禁忌dvd放荡欲情| 国产成人啪免费观看软件| 日韩综合小视频| 亚洲婷婷综合色高清在线| 精品国产一区久久| 在线观看日韩电影| 国产经典欧美精品| 欧美aaaaa成人免费观看视频| 亚洲三级理论片| 国产亚洲一区二区三区在线观看 | 亚洲一区二区三区免费视频| 2020国产精品自拍| 欧美日韩中字一区| 不卡在线观看av| 九九精品一区二区| 日韩av网站在线观看| 亚洲视频在线一区二区| 久久精品亚洲一区二区三区浴池| 欧美日韩亚洲综合| 91激情在线视频| 成+人+亚洲+综合天堂| 国产精品一二三四| 蜜臀av亚洲一区中文字幕| 亚洲超碰97人人做人人爱| 国产精品第五页| 日本一区二区视频在线观看| 久久夜色精品国产噜噜av | 日韩欧美一级特黄在线播放| 91丨porny丨户外露出| 成人午夜免费电影| 国产成人av福利| 国产老肥熟一区二区三区| 喷水一区二区三区| 日产欧产美韩系列久久99| 亚洲精品伦理在线| 亚洲欧美色一区| 亚洲精品免费看| 一区二区三区精品视频| 亚洲色图另类专区| 亚洲区小说区图片区qvod| 亚洲欧美自拍偷拍色图| 国产一区亚洲一区| 日本aⅴ亚洲精品中文乱码| 欧美网站大全在线观看| 91黄视频在线观看| 欧美综合色免费| 欧美艳星brazzers| 欧美日韩一区二区三区在线看| 日本道精品一区二区三区| 91国内精品野花午夜精品| 色综合咪咪久久| 欧美视频在线一区二区三区| 欧美无乱码久久久免费午夜一区| 欧美理论电影在线| 日韩一区二区在线观看视频播放| 欧美丰满一区二区免费视频| 欧美久久久久久久久| 色哟哟一区二区在线观看| 99久久99久久精品国产片果冻| 91精品1区2区| 欧美探花视频资源| 欧美福利视频一区| 欧美xxxxxxxx| 精品国产一区二区三区忘忧草| 91丝袜呻吟高潮美腿白嫩在线观看| 色激情天天射综合网| 欧美性感一类影片在线播放| 在线观看亚洲一区| 91麻豆精品91久久久久同性| 欧美精品少妇一区二区三区| 欧美一级理论片| 日韩片之四级片| 久久精品视频一区二区三区| 久久先锋影音av鲁色资源| 久久精品一区二区| 欧美国产欧美综合| 亚洲精品网站在线观看| 日本成人中文字幕在线视频| 国产一区二区精品久久99| 成人av影院在线| 91行情网站电视在线观看高清版| 在线观看免费亚洲| 日韩你懂的在线观看| 亚洲男帅同性gay1069| 亚洲成av人片一区二区| 日韩成人av影视| 国产白丝精品91爽爽久久| 96av麻豆蜜桃一区二区| 99国产精品视频免费观看| 这里是久久伊人| 久久久不卡网国产精品二区| 亚洲精品免费在线| 久久精品999| 99国内精品久久| 在线综合+亚洲+欧美中文字幕| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 91精品福利在线一区二区三区| 欧美不卡视频一区| 中文字幕一区二区三区在线播放| 午夜av区久久| 丁香五精品蜜臀久久久久99网站| 色婷婷av一区二区| 国产天堂亚洲国产碰碰| 午夜久久久久久电影| 高清在线成人网| 欧美猛男超大videosgay| 久久久亚洲精品石原莉奈| 亚洲天堂免费看| 国产风韵犹存在线视精品| 欧美无乱码久久久免费午夜一区 | 久久久久久久久久久电影| 一区二区三区四区不卡在线| 精品一区二区三区免费观看| 色综合久久中文综合久久牛| 欧美日韩1234| 亚洲欧洲中文日韩久久av乱码| 国产在线一区二区综合免费视频| 91国产成人在线| 国产欧美日韩视频一区二区| 日韩精品一区第一页| 色国产精品一区在线观看| 久久女同性恋中文字幕| 日本欧美一区二区三区乱码| 丁香网亚洲国际| 精品少妇一区二区三区在线视频| 一区二区三区在线视频观看 | 亚洲精品在线三区| 亚洲国产中文字幕| 97se亚洲国产综合自在线观| 国产精品欧美一区喷水| 韩国欧美国产一区| 日韩一区二区三区免费观看| 性做久久久久久免费观看| 色婷婷综合激情| 亚洲综合小说图片| 91丨porny丨中文| 亚洲欧洲av另类| 99久久er热在这里只有精品15| 久久先锋影音av鲁色资源网| 国产成人在线免费观看| 久久精品水蜜桃av综合天堂| 久久精品国产999大香线蕉| 日韩亚洲欧美一区| 天天操天天干天天综合网| 欧美一区二区三区婷婷月色 | 三级在线观看一区二区| 欧洲国产伦久久久久久久| 日韩美女视频一区二区| 不卡一区在线观看| 亚洲制服丝袜在线| 欧美日韩国产区一| 亚洲成人手机在线| 欧美电影一区二区三区| 亚洲视频你懂的| 欧美精品免费视频| 免费一级片91| 日韩欧美综合在线| 国产精品自在欧美一区| 国产亚洲精品久| 狠狠色丁香久久婷婷综合丁香| 欧美疯狂做受xxxx富婆| 麻豆成人免费电影| 国产精品免费视频一区| 色呦呦网站一区| 日韩极品在线观看|