请教大神如何解决!

jiangguishan 2014-10-02 01:07:35
D:\Microsoft Visual Studio\新建文件夹\sum\sum.cpp(9) : warning C4091: '' : ignored on left of 'float' when no variable is declared
D:\Microsoft Visual Studio\新建文件夹\sum\sum.cpp(9) : error C2143: syntax error : missing ';' before ','
D:\Microsoft Visual Studio\新建文件夹\sum\sum.cpp(9) : error C2143: syntax error : missing ';' before ','
D:\Microsoft Visual Studio\新建文件夹\sum\sum.cpp(11) : error C2065: 'a' : undeclared identifier
D:\Microsoft Visual Studio\新建文件夹\sum\sum.cpp(13) : error C2065: 'b' : undeclared identifier
D:\Microsoft Visual Studio\新建文件夹\sum\sum.cpp(14) : error C2065: 'sum' : undeclared identifier
执行 cl.exe 时出错.

sum.obj - 1 error(s), 0 warning(s)
下面的我的程序,楼主新手小菜鸟一个
// sum.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "iostream.h"

int main(int argc, char* argv[])
{
float,a,b,sum;
cout<<"Please enter a:"<<endl;
cin>>a;
cout<<"Please enter b:"<<endl;
cin>>b;
sum=a+b;
cout<<"The sum is:"<<sum<<endl;
return 0;
}
...全文
300 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2014-10-08
  • 打赏
  • 举报
回复
偶遇到类似问题都是用 “每次用/*...*/注释掉不同部分再重新编译,直到定位到具体语法出错的位置。” 的方法解决的。
yaorugang 2014-10-07
  • 打赏
  • 举报
回复
清除编译临时文件,重新编译就好了
bios8086 2014-10-07
  • 打赏
  • 举报
回复
引用 7 楼 jiangguishan 的回复:
[quote=引用 6 楼 u013171165 的回复:] 你这是什么时候的教材?去掉,这个根本就没用到。其他的就不吐槽了、
能推介一本教材,真的很想学习C++可是找不到人学习。[/quote] 谭浩强的书, 虽然被很多人批评,但是我觉得入门挺好的!
The_Third_Wave 2014-10-02
  • 打赏
  • 举报
回复
引用 7 楼 jiangguishan 的回复:
[quote=引用 6 楼 u013171165 的回复:] 你这是什么时候的教材?去掉,这个根本就没用到。其他的就不吐槽了、
能推介一本教材,真的很想学习C++可是找不到人学习。[/quote]C++ Primer 我不是大神,我还是菜鸟。
jiangguishan 2014-10-02
  • 打赏
  • 举报
回复
引用 6 楼 u013171165 的回复:
你这是什么时候的教材?去掉,这个根本就没用到。其他的就不吐槽了、
能推介一本教材,真的很想学习C++可是找不到人学习。
The_Third_Wave 2014-10-02
  • 打赏
  • 举报
回复
你这是什么时候的教材?去掉,这个根本就没用到。其他的就不吐槽了、
jiangguishan 2014-10-02
  • 打赏
  • 举报
回复
引用 3 楼 u013171165 的回复:
[quote=引用 2 楼 jiangguishan 的回复:] 去掉了还是原来那问题,是不是C++版本不完整?
float a, b, sum; 去掉留空格了么?[/quote] 去了还是有错误--------------------Configuration: 1 - Win32 Debug-------------------- Compiling... 1.cpp d:\microsoft visual studio\新建文件夹\1\1.cpp(4) : fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory 执行 cl.exe 时出错. 1.obj - 1 error(s), 0 warning(s)
jiangguishan 2014-10-02
  • 打赏
  • 举报
回复
留下来了,但是还是出现--------------------Configuration: 1 - Win32 Debug-------------------- Compiling... 1.cpp d:\microsoft visual studio\新建文件夹\1\1.cpp(4) : fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory 执行 cl.exe 时出错. 1.obj - 1 error(s), 0 warning(s)
The_Third_Wave 2014-10-02
  • 打赏
  • 举报
回复
引用 2 楼 jiangguishan 的回复:
去掉了还是原来那问题,是不是C++版本不完整?
float a, b, sum; 去掉留空格了么?
jiangguishan 2014-10-02
  • 打赏
  • 举报
回复
去掉了还是原来那问题,是不是C++版本不完整?
PoorMonk丶 2014-10-02
  • 打赏
  • 举报
回复
把float后面的逗号去掉

33,311

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧