| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 416 人关注过本帖
标题:while问题
取消只看楼主 加入收藏
huananligong
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2009-5-7
结帖率:90.91%
收藏
已结贴  问题点数:5 回复次数:0 
while问题
   enum orientation : byte
   {
      north = 1,
      south = 2,
      east = 3,
      west = 4
   }

   struct route
   {
      public orientation direction;
      public double distance;
   }

   class Program
   {
      static void Main(string[] args)
      {
         route myRoute;
         int myDirection = -1;
         double myDistance;
         Console.WriteLine("1) North\n2) South\n3) East\n4) West");
         do
         {
            Console.WriteLine("Select a direction:");
            myDirection = Convert.ToInt32(Console.ReadLine());
         }
         while ((myDirection < 1) || (myDirection > 4));
         Console.WriteLine("Input a distance:");
         myDistance = Convert.ToDouble(Console.ReadLine());
         myRoute.direction = (orientation)myDirection;
         myRoute.distance = myDistance;
         Console.WriteLine("myRoute specifies a direction of {0} and a " +
            "distance of {1}", myRoute.direction, myRoute.distance);
         Console.ReadKey();
      }
红色一句中为什么myDirection不是大于1和小于4 ?
2009-09-11 13:15
快速回复:while问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.070074 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved