0

这是我决定使用枚举器练习的以下代码(如果你得到引用,你会得到一个 cookie)。当我没有设置元组时,我经常在 do/while 循环中遇到错误。虽然我可以使用它们,但我打算稍后扩展相同的代码,因此在我看来,从长远来看,元组只会使过程变得更加混乱。

using System;

namespace Enumerator
{
class Program
{


    public enum color { Red, White, Green, Blue };
    public enum system { ZERO, LAMBDA, PSYCHOMU, _00 };
    public enum weapon { Beam_Rifle, _130mm_cannon, Flying_Bits, Beam_Cannon }



    static void Main(string[] args)
    {
        Console.Write("Choose configuaration of color, system, and weaponry for your mobile suit.");
        Console.WriteLine("You may only choose 1 system as having multiples on one frame will cause a malfunction.");
        Console.ReadLine();

        string color = enum Color;
        string system = enum System;
        string weapon = enum Weapon;


         do 
            {   
                color = Console.WriteLine(enum color);
                switch (color, system, weapon)

                case "Red":
                Console.WriteLine("Red");
                break;

                case "White":
                Console.WriteLine("White");
                break;

                case "Green":
                Console.WriteLine("Green");
                break;

                case "Blue":
                Console.WriteLine("Blue");
                break;

                default:
                Console.WriteLine("That is not a valid choice.");
                break;
               } while (color = Console.WriteLine(enum color));
            }
             Console.WriteLine();
             Console.ReadLine();



}
}
}
4

0 回答 0