Notice
Recent Posts
Recent Comments
Link
스토리지
[3.10] switch문 본문
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
namespace Study01
{
class Program
{
static void Main(string[] args)
{
int selectedCharacterId = 100;
string name = String.Empty;
switch (selectedCharacterId)
{
case 100:
name = "야만전사";
break;
case 200:
name = "악마사냥꾼";
break;
case 300:
break;
case 400:
break;
case 500:
break;
default:
break;
}
char lastName = name[name.Length - 1];
int index = (lastName - 0xAC00) % 28;
Console.WriteLine(name + (index != 0 ? "을 선택했습니다." : "를 선택했습니다"));
}
}
}
을(를) 이런거 붙는게 너무 보기싫어서 종성의 유무를 판단할 수 없을까 찾아본 결과 있었다.
'Unity > 수업내용(C#)' 카테고리의 다른 글
[3.10] 캐릭터 선택 - switch분기 (0) | 2021.03.10 |
---|---|
[3.10] 표준 입력 (0) | 2021.03.10 |
[3.9] 조건문, 반복문, 점프문 사용 예제 (스타크래프트) (0) | 2021.03.09 |
[3.9] for 반복문 (0) | 2021.03.09 |
[3.9] 반복문 및 조건문 응용 (0) | 2021.03.09 |
Comments