string与string.h区别

来源:互联网 发布:mac花屏两秒自动恢复 编辑:程序博客网 时间:2024/05/16 10:02

          在如#include <iostream.h> 等类似的头文件 中,都有一个#include <iostream>C++标准库的头文件 。

         一般 情况下#include <iostream.h> 等可以直接 使用其类的函数,而在使用用标准库#include <iostream>的文件中,

还需要添加using namespace std;或者在使用的时候加上std::cin 等。#include <iostream>是标准C++库的函数,需要使用命名空间,避免

重命名的错误。

         而这些之外,string与string.h区别f却是一个特例,#include <string>特指C++标准库中string类的头文件,但是#include <string.h>却非#include <string>

的同版本,它们 是不同的函数.C语言中#include <string.h指strcpy()等函数的头文件,如果要在C++中使用string和strcp()需要#include <string.h和

#include <string>

0 0
原创粉丝点击