| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1790 人关注过本帖
标题:为什么运行不了
只看楼主 加入收藏
earlybird119
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2013-4-22
结帖率:100%
收藏
已结贴  问题点数:2 回复次数:13 
为什么运行不了
#include stdio<>
main()
{
int a,b;
scantf("%d",&a);
b=abc(a);
printf("/%d/=%d\n",a,b);
}
int abc(x)
int x;
{
int y;
if(x>0) y=x;
esle y=-x;
return(y);
}
------------------------------------------------
VC++中运行结果 :
c:\documents and settings\administrator\桌面\vc++练习\cpp1.cpp(1) : error C2006: #include expected a filename, found 'identifier'
c:\documents and settings\administrator\桌面\vc++练习\cpp1.cpp(5) : error C2065: 'scantf' : undeclared identifier
c:\documents and settings\administrator\桌面\vc++练习\cpp1.cpp(6) : error C2065: 'abc' : undeclared identifier
c:\documents and settings\administrator\桌面\vc++练习\cpp1.cpp(7) : error C2065: 'printf' : undeclared identifier
c:\documents and settings\administrator\桌面\vc++练习\cpp1.cpp(9) : error C2065: 'x' : undeclared identifier
c:\documents and settings\administrator\桌面\vc++练习\cpp1.cpp(10) : error C2448: '<Unknown>' : function-style initializer appears to be a function definition
c:\documents and settings\administrator\桌面\vc++练习\cpp1.cpp(10) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错
----------------------------------------------------------
找不出哪里错了,但是放到TC 2.0中运行成功      
疑惑  大侠们帮我看看,谢谢
搜索更多相关主题的帖子: expected documents 练习 settings 
2013-04-22 21:26
ilyou2049
Rank: 1
等 级:新手上路
帖 子:5
专家分:2
注 册:2010-1-9
收藏
得分:0 
#include stdio<>
这句就错了
#include <stdio>
2013-04-22 21:28
earlybird119
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2013-4-22
收藏
得分:0 
回复 2楼 ilyou2049
  改了  运行还是错的

Compiling...
Cpp1.cpp
C:\Documents and Settings\Administrator\桌面\VC++练习\Cpp1.cpp(6) : error C2065: 'abc' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\VC++练习\Cpp1.cpp(9) : error C2065: 'x' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\VC++练习\Cpp1.cpp(10) : error C2448: '<Unknown>' : function-style initializer appears to be a function definition
C:\Documents and Settings\Administrator\桌面\VC++练习\Cpp1.cpp(10) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.
2013-04-22 21:31
earlybird119
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2013-4-22
收藏
得分:0 
回复 2楼 ilyou2049
ompiling...
Cpp1.cpp
C:\Documents and Settings\Administrator\桌面\VC++练习\Cpp1.cpp(6) : error C2065: 'abc' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\VC++练习\Cpp1.cpp(9) : error C2065: 'x' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\VC++练习\Cpp1.cpp(10) : error C2448: '<Unknown>' : function-style initializer appears to be a function definition
C:\Documents and Settings\Administrator\桌面\VC++练习\Cpp1.cpp(10) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.

Cpp1.obj - 1 error(s), 0 warning(s)
   

再帮我看看,谢谢~
2013-04-22 21:32
tremere
Rank: 6Rank: 6
来 自:火星
等 级:侠之大者
帖 子:223
专家分:432
注 册:2013-3-11
收藏
得分:0 
scanf打错了。。头文件错了。。
printf("/%d/=%d\n",a,b);这一句你是想干什么?输出a,b?

 fatal error C1004: unexpected end of file found没有期待的结束。。
少了一对花括号吧


极品菜鸟,来学习啦,啦啦啦啦啦啦啦。。。
2013-04-22 21:39
earlybird119
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2013-4-22
收藏
得分:0 
回复 5楼 tremere
scanf改回来了 还是那样。。晕

printf("/%d/=%d\n",a,b);/*输出"/a/=b"*/
2013-04-22 21:43
tremere
Rank: 6Rank: 6
来 自:火星
等 级:侠之大者
帖 子:223
专家分:432
注 册:2013-3-11
收藏
得分:0 
int abc(x)
{int x;
int y;
if(x>0) y=x;
esle y=-x;
return(y);
}
#include <stdio.h>
  int main()
{
  int a,b;
  scanf("%d",&a);
  b=abc(a);
  printf("%d,%d\n",a,b);
}

极品菜鸟,来学习啦,啦啦啦啦啦啦啦。。。
2013-04-22 21:48
ilyou2049
Rank: 1
等 级:新手上路
帖 子:5
专家分:2
注 册:2010-1-9
收藏
得分:0 
#include <stdio.h>
main()
{
    int abc(int x);
    int a,b;
    scanf("%d",&a);
    b=abc(a);
    printf("%d=%d\n",a,b);
}
int abc(int x)
{
    int y;
    if(x>0) y=x;
    else y=-x;
    return(y);
}
2013-04-22 21:48
czzdcn123
Rank: 7Rank: 7Rank: 7
来 自:江西
等 级:黑侠
威 望:3
帖 子:258
专家分:510
注 册:2013-3-7
收藏
得分:0 
楼主多看些书吧
2013-04-22 21:55
tremere
Rank: 6Rank: 6
来 自:火星
等 级:侠之大者
帖 子:223
专家分:432
注 册:2013-3-11
收藏
得分:0 
回复 7楼 tremere
输出改改看看

极品菜鸟,来学习啦,啦啦啦啦啦啦啦。。。
2013-04-22 21:57
快速回复:为什么运行不了
数据加载中...
 
   



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

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