#include<iostream.h>
#include<string.h>
using namespace std;
int main(){
int a(10);
cout<<a;
}
will be run ok but the code as fallows will be ...
#include<iostream.h>
#include<string.h>//here need to #include<string>
using namespace std;
int main(){
int a(10);
cout<<a;
string mystr = "c++ std error";
cout<<mystr;//notice here. error occur!!
}
本文通过两个示例对比展示了如何正确地使用C++标准库。第一个示例仅使用了<iostream.h>和<string.h>,而第二个示例则引入了<string>来处理字符串变量。文章突出了在使用C++标准库时应注意的细节。
1126

被折叠的 条评论
为什么被折叠?



