📄 subject_23182.htm
字号:
<p>
序号:23182 发表者:苦闷 发表日期:2002-12-02 12:35:59
<br>主题:简单问题
<br>内容:#include <iostream.h><BR>#include <string.h><BR>using namespace std;<BR>void main()<BR>{<BR>string str[5];<BR>for(int i=0; i<5; i++)<BR>{<BR> cin>>str[i];<BR> cout<<"str["<<i<<"]="<<str[i]<<endl;;<BR>}<BR>error C2871: 'std' : does not exist or is not a namespace<BR>error C2065: 'string' : undeclared identifier<BR>error C2146: syntax error : missing ';' before identifier 'str'<BR>error C2065: 'str' : undeclared identifier<BR>error C2109: subscript requires array or pointer type<BR>error C2109: subscript requires array or pointer type<BR>error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'int' (or there is no acceptable conversion)<BR>error C2109: subscript requires array or pointer type<BR>Error executing cl.exe.<BR>13.exe - 8 error(s), 0 warning(s)}<BR>还有using namespace std;是什么意思。<BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:Norton AntiVirus 回复日期:2002-12-02 12:37:25
<br>内容:建议参考《Thinking in C++》这本书<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:bird 回复日期:2002-12-02 12:46:11
<br>内容:因为string 被封在命名空间std里<BR><BR>1、<BR>#include <string><BR>using namespace std ;<BR><BR>string strtemp;<BR><BR>2、<BR>#include <string><BR><BR>std::string strtemp;
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:苦闷 回复日期:2002-12-02 13:28:21
<br>内容:#include <iostream><BR>#include <string><BR>和<BR>#include <iostream.h><BR>#include <string.h>什么不同的。<BR><BR>2002-12-2 13:34:02
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -