请问#include与#include有什么区别?

hyqryq 2001-05-21 09:49:00
加精
1.如题!
2.请问STL中vector与list有什么区别?

谢谢!
...全文
1728 14 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
shellrui 2001-05-22
  • 打赏
  • 举报
回复
vector向量模版,支持很多十分有效的向量方法,功能较list强多了
shellrui 2001-05-22
  • 打赏
  • 举报
回复
#include <iostream>//限制在标准的命名空间
use namespace std;
=====
#include <iostream.h>
孩皮妞野 2001-05-22
  • 打赏
  • 举报
回复
xuexi.
wbc_58 2001-05-22
  • 打赏
  • 举报
回复
旧版的iostrean.h函数现在存在于自己的库中:LIBCID.LIB LIBCIMID.LIB及MSVCIRTD.LIB。 新版的iostrean函数以及其他的许多新的函数存在于标准的c++库中:LIBCPD.LIB LIBCPMID.LIB MSVCPRID.LIB
他们不兼容,只有其一与我们的工程连接。
myan 2001-05-22
  • 打赏
  • 举报
回复
跟vector什么的没关系。iostream.h这个头文件(以及所有的.h)早在1995年就被委员会
摒弃,新的标准头文件都是没有后缀名的形式。 并且所有的标识符均声明在namespace std
中。除此之外很多具体内容也发生了变化。避入模板化,比如ofstream开启的缺省模式就是
可写的,比如废除了ios_base类中的一些标识符。具体的内容请看scott meyers等人的著作
和其他的资料。

现在iostream.h只是各厂商为了保持向后兼容而留下的旧时代的尾巴,早晚会割去。

其实无需很多废话,很简单的,以后不要使用iostream.h了,直接使用iostream就是了。
sczhh 2001-05-22
  • 打赏
  • 举报
回复
参考 eff c++

Incidentally, that's no typo in the Item title; I really mean <iostream> and not <iostream.h>. Technically speaking, there is no such thing as <iostream.h> — the °standardization committee eliminated it in favor of <iostream> when they truncated the names of the other non-C standard header names. The reasons for their doing this are explained in Item 49, but what you really need to understand is that if (as is likely) your compilers support both <iostream> and <iostream.h>, the headers are subtly different. In particular, if you #include <iostream>, you get the elements of the iostream library ensconced within the namespace std (see Item 28), but if you #include <iostream.h>, you get those same elements at global scope. Getting them at global scope can lead to name conflicts, precisely the kinds of name conflicts the use of namespaces is designed to prevent. Besides, <iostream> is less to type than <iostream.h>. For many people, that's reason enough to prefer it.
renyukun 2001-05-21
  • 打赏
  • 举报
回复
#include<iostream>是新的标准库头文件,主要区别在iostream库中,看一下名字空间(namespace)。
cber 2001-05-21
  • 打赏
  • 举报
回复
1,区别是有的,使用<iostrem>可以使用std中的iostream,它们都是用template做出来的,而使用<iostream.h>则是使用老式的iostream。建议使用新式的头文件<iostream>
2.vector与list有着本质的区别,vector是对应于数据结构中的队列(数组,我也不知道该怎么说),而list对应于数据结构中的链表
gnuljf 2001-05-21
  • 打赏
  • 举报
回复
收益不浅:)
pgcat 2001-05-21
  • 打赏
  • 举报
回复
区别不大
hello_wyq 2001-05-21
  • 打赏
  • 举报
回复
噢,原来如此,俺一直以为室一样的。
楼上的多谢了1

dux 2001-05-21
  • 打赏
  • 举报
回复
iostream.h是vc4.2版本之前的,iostream是之后的,主要是:
4,2版本之后,把standard C++ library加了进来,把原来的C Run_time library 中的iostream library移出,形成了一个单独的库,同时,standard C++ library中也有新的iostream函数,并且这两个新旧版本的iostream库不兼容,不能在同一个程序中调用.
vcmfc 2001-05-21
  • 打赏
  • 举报
回复
2.有区别,vector是动态数组,而list是双向链表。

我也说不清楚呀!
vcmfc 2001-05-21
  • 打赏
  • 举报
回复
1.没区别,只不过前者是旧方法,后者是C++的标准方法。

70,021

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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