| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1405 人关注过本帖
标题:代码编译不出来,求指教
取消只看楼主 加入收藏
屋顶
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
快速回复:代码编译不出来,求指教
数据加载中...
 
   



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

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