一个关于string字符串的问题

bendragon 2003-02-09 05:11:06
我在VC6.0中编译的,选用的是[Win32 Application],我写下如下代码请问主何编译通不过
#include <iostream.h>
#include <string>
using namespace std;
//typedef basic_string<char> string;
int main()
{
string srt("The expense of spirit/n");
//string srt="The expense of spirit/n";
cout<< "The size of"<<srt<<"is"<<srt.size()<<"characters,including the newline\n";
return 0;
}
不加"using namespace std";string出错,string没定义
加“using namespace std”;cout后面的"<<"出错
请问应怎么改?
...全文
17 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Frank001 2003-02-09
  • 打赏
  • 举报
回复

#include <iostream.h>
改为
#include <iostream>
就可以了

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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