subject_19149.htm
来自「一些关于vc的问答」· HTM 代码 · 共 12 行
HTM
12 行
<p>
序号:19149 发表者:木玛 发表日期:2002-10-25 20:42:03
<br>主题:yi这是什么问题 ???
<br>内容:以前写的时候从没有遇到这样的问题这是奇怪了<BR><BR>#include<stdio.h><BR>main()<BR>{<BR> float a[30][3],<BR> i,h,j;<BR><BR> for(i=0;i<30;i++)<BR> {<BR> for(j=0;j<3;j++)<BR> {<BR> scanf("%f",&a[i][j]);<BR> }<BR> }<BR> for(j=0;j<3;j++)<BR> {<BR> for(i=0;i<30;i++)<BR> {<BR> h+=a[j][i];<BR> }<BR> printf("%f",h/30);<BR> }<BR> return 0;<BR>}<BR>scanf("%f",&a[i][j]);处: <BR>error C2108: subscript is not of integral type<BR>error C2108: subscript is not of integral type<BR>error C2102: '&' requires l-value<BR><BR>h+=a[j][i];处: <BR>error C2108: subscript is not of integral type<BR>error C2108: subscript is not of integral type<BR>error C2297: '+=' : illegal, right operand has type 'float (*)[3]'<BR>Error executing cl.exe.<BR>这是奇怪了??????<BR><BR>谢谢了<BR>
<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-25 21:07:08
<br>内容:应该是这样吧~~~<BR><BR>#include<stdio.h><BR>main()<BR>{<BR> float a[30][3],h;<BR> int i,j;<BR><BR>...<BR><BR>}<BR><BR>数组的下标当然不能为浮点数啊<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 + =
减小字号Ctrl + -
显示快捷键?