今天看入门经典被例题难住了 看了一天都没看明白!求个好人给解释下!
using System;using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication29
{
enum orientation : byte
{
north=1,
south=2,
east=3,
west=4
}
struct route
{
public orientation direction;
public double distance;
}
class Program
{
[STAThread]
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);
}
}
}
一直看不明白这个题的意思 包括显示结果的原理。尤其是红色不分一直想不明白这几个量究竟怎么回事 麻烦谁给指点下!