新手求学-使用有什么区别吗??见笑了!

vip163 2004-05-07 11:38:32
//新手求学-使用<iostream>和<iostream.h>有什么区别吗??见笑了!

#include <iostream> //这里使用<iostream>和<iostream.h>有什么区别吗??

using namespace std; //还有这里"using namespace std;"和"using std::cout;"

int main()
{
cout<<"^_^";
}
...全文
45 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
angelboycn 2004-05-09
  • 打赏
  • 举报
回复
namespace
一条晚起的虫 2004-05-09
  • 打赏
  • 举报
回复
.h是为了兼容的,新的C++标准用不带.h的头文件
建议搂主看 TPL
Jinhao 2004-05-08
  • 打赏
  • 举报
回复
更多的区别
区别一
没有 .h 的是用 template 重写的,例如你可以这样来满足你的一些要求
typedef basic_string<int> intstring;
方便对一组int的处理 (假若没有 STL vector)

区别二
没有 .h的 支持双字节字符
#include<iostream>
#include<string>
using namespace std;

int main(){
string str="给我钱";
cout<<str.length()<<endl;
wstring wstr=L"给我钱";
wcout<<wstr.length()<<endl;
}
vip163 2004-05-08
  • 打赏
  • 举报
回复
多谢!多谢!
llmxp6 2004-05-08
  • 打赏
  • 举报
回复
我觉得斑竹应该多做工作,收集热门帖子,置顶!
liushuaiboy 2004-05-08
  • 打赏
  • 举报
回复
using namespace std;是老问题了,楼主尽量搜索一下,不然可用分就白白浪费了,如果多的话,可以给我。^_^
银点 2004-05-08
  • 打赏
  • 举报
回复
不记得是哪本书了,它里边说<iostream>里边内存的管理、流的控制、字符的处理方法都比<iostream.h>要新,修正了很多.h中的不足,效率也有提高。
建议在C++中最好全部使用没有.h的头文件
queena 2004-05-08
  • 打赏
  • 举报
回复
right!
bmwboy 2004-05-08
  • 打赏
  • 举报
回复
好像是C语言的头文件就要加.h,C++的就不用
cancer001 2004-05-08
  • 打赏
  • 举报
回复
#include <iostream> //这里使用<iostream>和<iostream.h>有什么区别吗??

using namespace std;//使用



#include <iostream.h> //这里使用<iostream>和<iostream.h>有什么区别吗??

using namespace std;//不必须使用
classrect 2004-05-08
  • 打赏
  • 举报
回复
mark
vip163 2004-05-08
  • 打赏
  • 举报
回复
多谢!Jinhao(辣子鸡丁)(灌水是我无言的抗议)----老兄

newegg2002 2004-05-07
  • 打赏
  • 举报
回复
int main()
{
cout<<"^_^";
  return 0;  
}
wangnewton 2004-05-07
  • 打赏
  • 举报
回复
老问题了
看看这个
http://expert.csdn.net/Expert/topic/2933/2933320.xml?temp=.959057

15,440

社区成员

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

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