标题:代码编译不出来,求指教
取消只看楼主
屋顶
Rank: 1
等 级:新手上路
帖 子:174
专家分:7
注 册:2016-2-27
结帖率:92.86%
 问题点数:0 回复次数:0 
代码编译不出来,求指教
#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
求大神指教,谢谢
搜索更多相关主题的帖子: 信息 include 
2016-04-21 17:01



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-463951-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.559529 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved