⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_19435.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:19435 发表者:mixture 发表日期:2002-10-28 23:04:24
<br>主题:大菜鸟的问题:请帮我看看这个程序怎么了?
<br>内容://Listing 5.4 -demonstrating variables<BR>//scoped within a block<BR><BR>#include &lt;iostream.h&gt;<BR><BR>void myFunc();<BR><BR>int main()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;int x=5;<BR>&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt;"\nIn main x is :" &lt;&lt; X;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;myFunc();<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt; "\nBack in main, x is :"&lt;&lt;x;<BR>&nbsp;&nbsp;&nbsp;&nbsp;return 0;<BR>}<BR><BR>void myfunc()<BR>{<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;int x=8;<BR>&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt;"\nIn myFunc,local x is :"&lt;&lt;x&lt;&lt;endl;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt;"\nIn block in myFunc, x is : "&lt;&lt; x;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int x =9;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt;"\nVery local x :" &lt;&lt;x;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;cout &lt;&lt;"\nOut of block, in myFunc, x:" &lt;&lt; x &lt;&lt;endl;<BR>}<BR><BR>编译提示:error c2065 11行中'x': undeclared identifier 
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:混混 回复日期:2002-10-28 23:10:54
<br>内容:cout &lt;&lt;"\nIn main x is :" &lt;&lt; X; 大写的 'X' ???? <BR><BR>//余下的没看<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>
回复者:*** 回复日期:2002-10-28 23:36:58
<br>内容:恭喜第2次得分
<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-10-29 01:27:35
<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>
回复者:*** 回复日期:2002-10-29 01:35:24
<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>
回复者:*** 回复日期:2002-10-29 01:35:57
<br>内容:我这人喜欢笑,所以您就多包涵了
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -