#include<iostream>
#include<string>
using namespace std;
void main(){
string str="abc";
cout<<str;
system("pause");
}
Run Code Online (Sandbox Code Playgroud)
如果我不包含字符串头文件,那么<< in line cout <中 会出现错误
我认为错误将在定义str的行.
Jos*_*eld 10
标准库头可以包含其他标准库头,即使未在标准中指定.因此,对于您的实现,iostream标题可能包含标题的某些部分string,因此std::string可用但std::operator<<(std::basic_ostream<...>&, const std::basic_string<...>&);不是.
| 归档时间: |
|
| 查看次数: |
3955 次 |
| 最近记录: |