| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1420 人关注过本帖
标题:问个很傻的未声明的标识符错误的问题
只看楼主 加入收藏
yz29631
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2007-6-20
收藏
 问题点数:0 回复次数:16 
问个很傻的未声明的标识符错误的问题

我的源文件为
#include <iostream>
int main ()
{
char a,b,c;
a = 'b';
b = 'c';
c = a;

cout << a << b << 'c';
return 0;
}

编译时提示 \aaa.cpp(9) : error C2065: “cout”: 未声明的标识符
cout不是打印到屏幕吗?哪里出错了,真是奇怪。
PS 小弟刚刚开始学,不要笑我啊

搜索更多相关主题的帖子: 符错误 声明 
2007-06-24 22:13
yuyunliuhen
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:1435
专家分:0
注 册:2005-12-12
收藏
得分:0 
#include <iostream>
using namespace std;//加上这个


Go confidently in the  directions of your dreams,live the life you have imagined!Just do it!
It is no use learning without thinking!
2007-06-24 22:24
aipb2007
Rank: 8Rank: 8
来 自:CQU
等 级:贵宾
威 望:40
帖 子:2879
专家分:7
注 册:2007-3-18
收藏
得分:0 
#include <iostream>
using namespace std;

or

std::cout << a << b << 'c';

Fight  to win  or  die...
2007-06-24 22:25
yz29631
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2007-6-20
收藏
得分:0 
using namespace std 是不是只要有同类的多个变量就要用啊?
2007-06-24 22:27
yuyunliuhen
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:1435
专家分:0
注 册:2005-12-12
收藏
得分:0 
不是的,这个没什么关系的吧

using namespace std 使用名称空间标识符std,这样在原来使用名称空间的头文件里就可以直接使用里面定义的全局变量

Go confidently in the  directions of your dreams,live the life you have imagined!Just do it!
It is no use learning without thinking!
2007-06-24 22:34
aipb2007
Rank: 8Rank: 8
来 自:CQU
等 级:贵宾
威 望:40
帖 子:2879
专家分:7
注 册:2007-3-18
收藏
得分:0 
以下是引用yz29631在2007-6-24 22:27:40的发言:
using namespace std 是不是只要有同类的多个变量就要用啊?

std是个名字空间,很多名字是在这个空间内定义的。
以后写程序都加上using namespace std;就行了。


Fight  to win  or  die...
2007-06-24 22:34
aipb2007
Rank: 8Rank: 8
来 自:CQU
等 级:贵宾
威 望:40
帖 子:2879
专家分:7
注 册:2007-3-18
收藏
得分:0 
yuyunliuhen:

怎么搞的,两次撞在一起了!呵呵

Fight  to win  or  die...
2007-06-24 22:35
aipb2007
Rank: 8Rank: 8
来 自:CQU
等 级:贵宾
威 望:40
帖 子:2879
专家分:7
注 册:2007-3-18
收藏
得分:0 
还都比你慢几秒,

Fight  to win  or  die...
2007-06-24 22:36
yuyunliuhen
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:1435
专家分:0
注 册:2005-12-12
收藏
得分:0 

Go confidently in the  directions of your dreams,live the life you have imagined!Just do it!
It is no use learning without thinking!
2007-06-24 22:36
yuyunliuhen
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:1435
专家分:0
注 册:2005-12-12
收藏
得分:0 
刚才是我慢了  (*^__^*)

Go confidently in the  directions of your dreams,live the life you have imagined!Just do it!
It is no use learning without thinking!
2007-06-24 22:36
快速回复:问个很傻的未声明的标识符错误的问题
数据加载中...
 
   



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

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