请大家看看哪里错了~

作者在 2010-05-15 19:29:47 发布以下内容
输入一数组 并反序输出  
 
 
 
#include "stdio.h"
  int a[10];
 int  fd(int b[10]);
 {int i;
  
  for (i=0;i<10;i++)
  a[9-i]=b[i];
  
  
  
  }
 
  main()
{int j,p,a[10];
 for(j=0;j<10;j++)
 scanf ("%d",&a[j]);
 fd(a);
 for (p+0;p<10;p++)
 printf("%d",a[p])
   
}
C语言 | 阅读 484 次
文章评论,共6条
ThinkAndDo
2010-05-15 20:12
1
您好,估计您是刚开始学编程,简易您还是要认真先读一些编程的书,然后充分利用VC工具帮你找出错误。<br />
就本程序而言:<br />
1,在定义函数时,不要用‘;’结束int&nbsp;&nbsp;fd(int b[10]);。<br />
2,由于你的函数你定义的是返回一个int型,但是你的函数体却没有返回int型的值。<br />
3,在main函数中的for循环中,你的p+0,不解,估计是写错了。<br />
4,在printf的结尾少了‘;’。
小D(作者)
2010-05-15 20:18
2
<div class="quote"><span class="q"><b>ThinkAndDo</b>: 您好,估计您是刚开始学编程,简易您还是要认真先读一些编程的书,然后充分利用VC工具帮你找出错误。<br />
就本程序而言:<br />
1,在定义函数时,不要用‘;’结束int&nbsp;&nbsp;fd</span></div>嗯嗯&nbsp; &nbsp;谢谢你 我会努力的~
zyzab
2010-05-17 23:29
3
#include &quot;stdio.h&quot;<br />
main()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; int j,p,a[10];<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(j=0;j&lt;10;j++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scanf(&quot;%d&quot;,&amp;a[j]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(p=9;p&gt;0;p--)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;%d&quot;,a[p]);<br />
}<br />
直接这样就行了,不用调用函数了,书写代码要注意格式啊!如果你真的要调用函数再来找我吧!
wtuaimmmm
2010-05-20 20:08
4
(p+0;p&lt;10;p++)
实数虚数
2010-05-21 16:39
5
#include &quot;stdio.h&quot;<br />
#define N 10&nbsp; &nbsp;&nbsp;&nbsp;//定义一个字符常量<br />
 void&nbsp;&nbsp;fd(int b[N])<br />
 {<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;int i;<br />
&nbsp; &nbsp;int a[N];<br />
&nbsp;&nbsp;for (i=0;i&lt;N;i++)<br />
&nbsp;&nbsp;a[9-i]=b<i>;<br />
&nbsp;&nbsp;for(i=0;i&lt;N;i++)<br />
&nbsp;&nbsp;printf(&quot;a[%d]=%d\n&quot;,i,a<i>);//这里输出排序后的数组元素<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;<br />
 void main()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;int j,p,a[10];<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;printf(&quot;请输入数组中的元素:&quot;);<br />
 for(j=0;j&lt;10;j++)<br />
 scanf (&quot;%d,&quot;,&amp;a[j]);//以逗号最为分割符<br />
 fd(a);<br />
 <br />
}
Stephen限
2010-05-21 21:55
6
if函数后面要加上{},估计是刚学编程,好好加油&nbsp; &nbsp;前程很好
游客请输入验证码
浏览484次
文章归档