| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <string.h> #define WORDS 5 int main(void) { int i, index; char dic[WORDS][2][30] = { { "book", "책" }, { "boy", "소년" }, { "computer", "컴퓨터" }, { "language", "언어" }, { "rain", "비" }, }; char word[30]; printf("단어를 입력하시오:"); scanf("%s", word); index = 0; for (i = 0; i < WORDS; i++) { if (strcmp(dic[index][0], word) == 0) { printf("%s: %s\n", word, dic[index][1]); return 0; } index++; } printf("사전에서 발견되지 않았습니다.\n"); return 0; } | cs |


https://itsys.hansung.ac.kr/cgi-bin/onlineTest/viewCcoding/onlineCcoding.cgi?source=src/chap10/dic.c
C프로그래밍(프로그래밍언어) 실습게시판