public static void RunProblems() { Console.WriteLine("Please write the number of the problem you want"); int problem; String[] problems = Enum.GetNames(typeof(probType)); for (int number = 1; number < problems.Length; number++) { Console.WriteLine((number) + "- " + problems[number]); } Problem DoThis; bool good = int.TryParse(Console.ReadLine(), out problem); if (!good) { DoThis = new Problem(probType.Z_Error_Not_Defined); } else { String name = Enum.GetName(typeof(probType), problem); probType type = (probType)Enum.Parse(typeof(probType), name); DoThis = new Problem(type); } DoThis.Solution(); }
public Problem(probType type_I) { type = type_I; }