c++编译程序将一个数组中的所有元素倒序存放,编译不通过!
codeblocks吧
全部回复
仅看楼主
level 2
李政翰17 楼主
#include<iostream>
int main()
{
int a[5],i,temp;
cout<<"input a:";
for (i=0;i<5;i++)
{
cin>>a[i];
}
cout<<"array a:";
for (i=0;i<5;i++)
cout<<a[i]<<" ";
cout<<endl;
for (i=0;i<2;i++)
{
temp=a[i];
a[i]=a[4-i];
a[4-i]=temp;
}
cout<<"now array a:";
for (i=0;i<5;i++)
cout<<a[i]<<endl;
}
2015年02月04日 11点02分 1
level 8
编译不通过的话,下面应该会写什么错误,然后你把那些错误复制一下,百度,就有答案了
随便一提,你没有指定命名空间
using namespace std;
2015年02月04日 12点02分 2
level 1
同上,话说程序写得有点乱
2015年02月14日 01点02分 3
level 7

2015年02月14日 03点02分 4
level 7
感觉…
2015年02月14日 03点02分 5
level 12
return呢
2015年02月15日 00点02分 6
level 2
李政翰17 楼主
谢谢各位的提醒!编译已通过!
2015年02月15日 03点02分 7
1