一个严重问题
#include <iostream>
#include <string>
using namespace std;
void main()
{ int len;
sting str="chinese";
len=size(str);
cout<<len;
}
编译的错误提示是:
--------------------Configuration: first - Win32 Debug--------------------
Compiling...
first use.cpp
F:\C++\first\first use.cpp(6) : error C2065: 'sting' : undeclared identifier
F:\C++\first\first use.cpp(6) : error C2146: syntax error : missing ';' before identifier 'str'
F:\C++\first\first use.cpp(6) : error C2065: 'str' : undeclared identifier
F:\C++\first\first use.cpp(6) : error C2440: '=' : cannot convert from 'char [8]' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
F:\C++\first\first use.cpp(8) : error C2065: 'size' : undeclared identifier
Error executing cl.exe.
first use.obj - 5 error(s), 0 warning(s)
是不是 sting 定义错误,我是按书稍加修改的,
请问是什么问题呢?