看过c++prime的老大看过来
我在看到c++prime的这段程序后(程序如下:)
#include <string.h>
#include <iostream.h>
int mian()
{
string st=("The expense of spirit\n");
//st的长度由size()操作返回不包含终止空字符
cout<< "The size of "<< st<< " is " << st.size()<< " characters, including the newline\n";
return 0;
}
头文件是我加的,我在vc++6.0上进行编译的时候,我发现了许多的错误,不知道是怎么样搞的,我将这些
错误写在下面:(从vc++6.0中的错误信息出拷贝出)
C:\工作目录\学习编程中\cjia\cjia.cpp(5) : error C2065: 'string' : undeclared identifier
C:\工作目录\学习编程中\cjia\cjia.cpp(5) : error C2146: syntax error : missing ';' before identifier 'st'
C:\工作目录\学习编程中\cjia\cjia.cpp(5) : error C2065: 'st' : undeclared identifier
C:\工作目录\学习编程中\cjia\cjia.cpp(5) : error C2440: '=' : cannot convert from 'char [23]' to 'int'
C:\工作目录\学习编程中\cjia\cjia.cpp(7) : error C2228: left of '.size' must have class/struct/union type
我不知道怎么错了,请大家多多指点,谢谢了。