C++一个关于STRING的问题

来源:百度知道 编辑:UC知道 时间:2024/05/15 13:01:12
我想用STRING定义一个字符串数组
为什么出错?

#include <iostream>
#include <string>
int main()
{
string b[5];
return 0;
}

错误:
string' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)

在include完了之后加上:
using namespace std;

int main()
好像是这句有问题吧

数组你只有定义了
但是没有给它赋值

好像是CString b[5];

string是一个头文件你怎么可以这个当类型名呢,这样定义是错的