代码编译不出来,求指教
#include<stdio.h>#include<Ctype.h>
#include<string.h>
#define MAX 40
#define ANSWER "Grant"
main()
{
char try[MAX];
puts("Who is buried in Grant's tomb?");
gets(try);
toupper(ANSWER);
toupper(try);
while(strcmp(try,ANSWER)!=0)
{
puts("No,that's wrong.Try again.");
gets(try);
}
puts("That's right!");
}
如上代码编译不出来,编译信息如下:
g++.exe -x c++ -c E:\编程\c文件\iiiii -o E:\编程\c文件\iiiii.o -Wall -fpermissive -Wno-sign-compare -g
E:\编程\c文件\iiiii:7: warning: ISO C++ forbids declaration of `main' with no type
E:\编程\c文件\iiiii: In function `int main()':
E:\编程\c文件\iiiii:8: error: expected primary-expression before "char"
E:\编程\c文件\iiiii:8: error: expected `;' before "char"
E:\编程\c文件\iiiii:10: error: expected primary-expression before "try"
E:\编程\c文件\iiiii:11: warning: invalid conversion from `const char*' to `int'
E:\编程\c文件\iiiii:11: warning: initializing argument 1 of `int toupper(int)'
E:\编程\c文件\iiiii:12: error: expected primary-expression before "try"
E:\编程\c文件\iiiii:13: error: expected primary-expression before "try"
E:\编程\c文件\iiiii:16: error: expected primary-expression before "try"
Failure
求大神指教,谢谢