|
제가 c언어 공부를 하는데 이문제를 풀수없어 도움을 청합니다.. 꼭 해결해주세요..
문제)
사전을 검색하는 프로그램을 완성하시오.
1. 사전 끝에는 NULL이 있다.
2. 단어의 입력이 없을 때 프로그램을 끝낸다
%?????????? 이 부분을 채워 넣으면 되는것입니다.
#include <stdio.h>
void main()
{
static char *aDic[][2] = {
"apple", "apple is 사과",
“history”, “history is 역사”,
"person", "person is 사람",
NULL, NULL
};
char sWords[50];
char *sMeaning;
while (1) {
/* declare prototype for function searchFor here */
?????????????
printf("? ");
gets(sWords);
if (*sWords == NULL)
break;
sMeaning = searchFor(sWords, aDic);
if (sMeaning == NULL)
printf("No Word in the dictionary\n");
else
printf("%s: %s\n", sWords, sMeaning);
}
printf("Bye, ....\n");
}
char *searchFor(char *aWord, char *aDic[][2])
{
int i = 0;
????????????
????????????
????????????
return aDic[i][1];
}
|