(2009/03/12 06:08 작성)
#include <locale.h> #include <stdio.h> int main(void) { setlocale(LC_ALL, "Korean"); int in_char, in_cho, in_jung, in_jong; printf("Input a letter : "); do { wscanf(L"%c", &in_char); } while ( in_char < 0xAC00 || in_char > 0xD7A3); // 초`중`종성 분해 in_char = in_char - 0xAC00; in_cho = in_char / (21 * 28); in_jung = (in_char / 28) % 21; in_jong = in_char % 28; // 초`중`종성 print if ( in_jong == 0 ) wprintf(L"%c => %c + %c\n", in_char + 0xAC00, in_cho + 0x1100, in_jung + 0x1161); else wprintf(L"%c => %c + %c + %c\n", in_char + 0xAC00, in_cho + 0x1100, in_jung + 0x1161, in_jong + 0x11A7); } >> run Input a letter : 가 가 => ㄱ + ㅏ >> run Input a letter : 힣 힣 => ㅎ + ㅣ + ㅎ
댓글 없음:
댓글 쓰기