当前位置: 首页>>代码示例>>C++>>正文


C++ map::get_current_location方法代码示例

本文整理汇总了C++中map::get_current_location方法的典型用法代码示例。如果您正苦于以下问题:C++ map::get_current_location方法的具体用法?C++ map::get_current_location怎么用?C++ map::get_current_location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在map的用法示例。


在下文中一共展示了map::get_current_location方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: shuffle_gates

void schedule::shuffle_gates(void)
{
int temp;
char *temp_point;

   if (airport.get_current_location() == &rest_room)
      visited_rest_room = TRUE;

   if ((airport.get_current_location() ==
                                 gate[my_gate]) && (!gates_frozen)) 
   {
      temp             = flight_number[0];
      flight_number[0] = flight_number[1];
      flight_number[1] = flight_number[2];
      flight_number[2] = flight_number[3];
      flight_number[3] = temp;

      temp_point     = destination[0];
      destination[0] = destination[1];
      destination[1] = destination[2];
      destination[2] = destination[3];
      destination[3] = temp_point;

      temp           = depart_hour[0];
      depart_hour[0] = depart_hour[1];
      depart_hour[1] = depart_hour[2];
      depart_hour[2] = depart_hour[3];
      depart_hour[3] = temp;

      temp             = depart_minute[0];
      depart_minute[0] = depart_minute[1];
      depart_minute[1] = depart_minute[2];
      depart_minute[2] = depart_minute[3];
      depart_minute[3] = temp;

      my_gate = (my_gate + 3) % 4;  // Subtract one from my_gate

      cout <<
         "A message is heard on the airport paging system, \"All"
         " gates\nhave been rescheduled due to bad weather.  No "
         "flights have\nbeen cancelled at this time.\"\n";

   }
}
开发者ID:danohuiginn,项目名称:sandbox,代码行数:44,代码来源:schedule.cpp

示例2: check_flight

void schedule::check_flight(void)
{

   if ((airport.get_current_location() == &plane1) ||
         (airport.get_current_location() == &plane2) ||
           (airport.get_current_location() == &plane3) ||
             (airport.get_current_location() == &plane4)) 
   {
                                               // You must have a ticket
      if (!personal_items.item_here(ticket))
      {
         cout <<
         "Unfortunately, you don't have a ticket, you are arrested\n"
         "as a stowaway and drug off the plane screaming.  No vaca-\n"
         "tion for you.\n";
      }
      
                                            // On plane 1 from gate 1
      else if ((airport.get_current_location() == &plane1) &&
                                                      (my_gate != 0))
      {
         cout <<
         "Unfortunately, you are at gate 1 and this flight is going\n"
         " to " << destination[0] << ".  Better luck next time.\n";
      }
      
                                            // On plane 2 from gate 2
      else if ((airport.get_current_location() == &plane2) &&
                                                      (my_gate != 1))
      {
         cout <<
         "Unfortunately, you are at gate 2 and this flight is going\n"
         " to " << destination[1] << ".  Better luck next time.\n";
      }
      
                                            // On plane 3 from gate 3
      else if ((airport.get_current_location() == &plane3) &&
                                                      (my_gate != 2))
      {
         cout <<
         "Unfortunately, you are at gate 3 and this flight is going\n"
         " to " << destination[2] << ".  Better luck next time.\n";
      }
      
                                            // On plane 4 from gate 4
      else if ((airport.get_current_location() == &plane4) &&
                                                      (my_gate != 3))
      {
         cout <<
         "Unfortunately, you are at gate 4 and this flight is going\n"
         " to " << destination[3] << ".  Better luck next time.\n";
      }
      
                                               // You must be on time
      else if ((time_of_day.present_hour() > depart_hour[my_gate]) ||
               (time_of_day.present_minute() > depart_minute[my_gate]))
      {
         cout <<
         "Unfortunately, you are too late for your flight and are\n"
         "aboard a cargo plane to Greasy Creek, Missouri.  Better\n"
         "luck next time.\n";
      }
      
                                               // You must have candy
      else if (!personal_items.item_here(candy))
      {
         cout <<
         "Unfortunately, you failed to bring any food along and you\n"
         "died of malnutrition half way to your destination.\n";
      }

                                      // You must visit the rest room
      else if (!visited_rest_room)
      {
         cout <<
         "Unfortunately, you forgot to take care of your bladder\n"
         "problem back at the airport.  The restrooms on this plane\n"
         "are out-of-order.  You suffer a ruptured bladder and die\n"
         "enroute to your destination.\n";
      }

                             // A successful trip through the airport
      else
      {
         cout <<
         "Congratulations, you are comfortably enroute to your well\n"
         "deserved vacation.  You can study the source code to this\n"
         "program on the plane.  If you do not have the source code,\n"
         "you can read the paper in the lobby for the address where\n"
         "you can write for more information.\n";
      }

      input_words.stop_game();  // End the game
   }
}
开发者ID:danohuiginn,项目名称:sandbox,代码行数:95,代码来源:schedule.cpp


注:本文中的map::get_current_location方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。