Parsing words in C; Translating program

I'm developing a program that will translate a string from the user (English) into Spanish. For the assignment I'm given a file that contains a list of a 100 words and their spanish equivalent. I've successfully opened that file, and fed it to the string with a two dimensional array. What I'm having difficulty with is parsing the words so it will allow me to find the equivalent version of the given words; any words that aren't given are suppose to be replaced with asterisks (*). Any ideas on how I can parse the words from the users inputted string? Below is snippits of the source code to save some time. --Thanks char readFile[100][25]; fp = fopen("words.dat", "r"); if (fp == NULL){ printf ("File failed to load\n"); } //This is how I stored the file into the two dimensional string. while (fgets(readFile, 100, fp)){ x++; } printf ("User please input string\n"); gets (input); That's as far as I've gotten. I commented out the for-loop that outputs the words so I can see the words (for the sake of curiousity) and it was successful. The format of the file string is (english word), (spanish word).

以上就是Parsing words in C; Translating program的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » CSS3 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准