2个回答
展开全部
#include <iostream>
#include <cstdlib>
using namespace std;
void Reverse(int a[], int n) {
int t;
for(int i = 0; i < n / 2; ++i) {
t = a[i];
a[i] = a[n - 1 - i];
a[n - 1 - i] = t;
}
}
void Show(int a[],int n) {
for(int i = 0; i < n; ++i)
cout << a[i] << " ";
cout << endl;
}
int main () {
int a[] = {12,54,62,31,41,25,18,92,103,456,85,25,29,76};
int n = sizeof(a)/sizeof(a[0]);
Show(a,n);
Reverse(a,n);
Show(a,n);
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询