请问c++中使用cin需要包含什么头文件?

tfd_long 2009-07-08 11:29:33
在源程序中,我使用了cin>>i;错误如下:
error C2065: 'cin' : undeclared identifier
warning C4552: '>>' : operator has no effect; expected operator with side-effect
Error executing cl.exe.
...全文
4571 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
HelloDan 2009-07-08
  • 打赏
  • 举报
回复
[Quote=引用楼主 tfd_long 的帖子:]
在源程序中,我使用了cin>>i;错误如下:
error C2065: 'cin' : undeclared identifier
warning C4552: '>>' : operator has no effect; expected operator with side-effect
Error executing cl.exe.
[/Quote]

刚学的吗? 第一章的内容。
没事造轮子 2009-07-08
  • 打赏
  • 举报
回复
#include<iostream.h>
或者直接在前面加
#include<iostream>
using namespace std;
如:

#include<iostream>
using namespace std;
int main()
{
return 0;
}
tfd_long 2009-07-08
  • 打赏
  • 举报
回复
解决了 谢谢!
mengjfu 2009-07-08
  • 打赏
  • 举报
回复
#include <iostream.h>
机智的呆呆 2009-07-08
  • 打赏
  • 举报
回复
#include<iostream>
大前置 2009-07-08
  • 打赏
  • 举报
回复

#include<iostream.h>
goodname 2009-07-08
  • 打赏
  • 举报
回复
#include<iostream>

using std::cin;

65,199

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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