用ctype.h中的函数重写下面的程序,使得不管用户选择的是大写还是小写,程序都可以识别正确答案。
/* compare.c -- 这个程序可以满足要求 */ #include <stdio.h> #include <string.h> /* 声明strcmp( )函数 */ #define ANSWER "Grant" #define MAX 40 int main (void) { char try[MAX]; puts ("Who is buried in Grant's tomb?"); gets (try); while (strcmp (try, ANSWER) != 0) { puts (No, that's wrong. Try again."); gets (try); } puts ("That's right!"); return 0; }