#include <iostream>
#define random
using namespace std;
void reverse(int a[]){
int x,y;
y=sizeof(a)/sizeof(a[0])-1;
for(x=0;x<=y;x++,y--){
int temp=a[x];
a[x]=a[y];
a[y]=temp; }
}
void printArray(int a[]){
int b,y;
y=sizeof(a)/sizeof(a[0]);
for(b=0;b<y;b++){
cout<<a[b]<<" "; }
}
int main(){
int b,N;
int max=100,min=20;
cin>>N;
int *a=new int[N];
for(b=0;b<N;b++){
a[b]=random(max)%(max-min+1)+min; cout<<a[b]<<" ";
}
cout<<" ";
reverse(a);
printArray(a);
system ("pause");
}
5 回答
- 5 回答
- 0 关注
- 1452 浏览
添加回答
举报
0/150
提交
取消