struct wordlist words[25]={{"abandon","vt,遗弃;放弃"}, {"abbreviation","n,缩写"}, {"abide","vt,忍受,容忍"}, {"ability","n,能力;才能"}, {"abnormal","n,异常的,反常的"}, {"aboard","在船,车,飞机上,上船(或车、飞机)"}, {"abolish","vt,废除"}, {"abortion","n,流产,堕胎;失败"} };
char input[20]; int words_index=0;
void main() {check_word: printf("%s\n",words[words_index].explain); scanf("%s\n",input); int _index=0;/*C:\TG42_C\word_exercise1.0.c(24) : error C2143: syntax error : missing ';' before 'type'*/
for(;words[words_index].word[_index]!='\0';_index++) {if(input[_index]!=words[words_index].word[_index]) {printf("单词输入错误!请重新输入:\n"); goto check_word;} } if (input[_index]!='\0') {printf("单词输入错误!请重新输入:\n"); goto check_word;} words_index++; if(words[words_index].word[0]!='\0') goto check_word; else printf("单词练习完毕!\n"); } 错误提示见注解!