enum 문제
Console(콘솔)/실습 2019. 9. 27. 16:44
using System;
namespace Syntax12 { class Program { enum Camp { Alliance,Horde } enum TribeAlliance{Human, Dwarf } enum TribeHorde {Orc, Undead } enum ClassHuman {Warlock,Priest } enum ClassDwarf {Monk,Hunter } enum ClassOrc {Deathknight,Warrior } enum ClassUndead {Wizaed, Theif } static void Main(string[] args) { Console.Write("[Alliance, Horde]진영을 선택해주세요."); Console.ForegroundColor = ConsoleColor.Green; string A = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White;
if (A == Camp.Alliance.ToString()) {
Console.Write("[Human,Dwarf]종족을 선택해주세요."); Console.ForegroundColor = ConsoleColor.Green; string B = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; if (B == TribeAlliance.Human.ToString()) { Console.Write("[Warlock, Priest]직업을 선택해주세요."); Console.ForegroundColor = ConsoleColor.Green; string C = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; if (C == ClassHuman.Warlock.ToString()) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"{A}, {B}, {C}"); Console.ForegroundColor = ConsoleColor.White; } else { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"{A}, {B}, {C}"); Console.ForegroundColor = ConsoleColor.White; } } else if (B == TribeAlliance.Dwarf.ToString()) { Console.Write("[Monk, Hunter]직업을 선택해주세요."); Console.ForegroundColor = ConsoleColor.Green; string C = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; if (C == ClassDwarf.Monk.ToString()) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"{A}, {B}, {C}"); Console.ForegroundColor = ConsoleColor.White; } else { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"{A}, {B}, {C}"); Console.ForegroundColor = ConsoleColor.White; } } } else if (A == Camp.Horde.ToString()) {
Console.Write("[Orc,Undead]종족을 선택해주세요."); Console.ForegroundColor = ConsoleColor.Green; string D = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; if (D == TribeHorde.Orc.ToString()) {
Console.Write("[Deathknight, Warrior]직업을 선택해주세요."); Console.ForegroundColor = ConsoleColor.Green; string C = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; if (C == ClassOrc.Deathknight.ToString()) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"{A}, {D}, {C}"); Console.ForegroundColor = ConsoleColor.White; } else { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"{A}, {D}, {C}"); Console.ForegroundColor = ConsoleColor.White; } } else if (D == TribeHorde.Undead.ToString()) { Console.Write("[Wizaed, Theif]직업을 선택해주세요."); Console.ForegroundColor = ConsoleColor.Green; string F = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; if (F == ClassUndead.Wizaed.ToString()) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"{A}, {D}, {F}"); Console.ForegroundColor = ConsoleColor.White; } else { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"{A}, {D}, {F}"); Console.ForegroundColor = ConsoleColor.White;
} } }
} } }
|
'Console(콘솔) > 실습' 카테고리의 다른 글
Claas를 이용한 버거 만들기 (0) | 2019.10.01 |
---|---|
method문 사용 (0) | 2019.09.30 |
두수를 입력받아 변수에 담기 (0) | 2019.09.26 |
switch 예제문 (0) | 2019.09.26 |
숫자 입력, 날짜 출력 (0) | 2019.09.26 |