代码
#include <iostream>
using namespace std;
int main()
{
int n; //数组长度
cin >> n;
int *a = new int[n];
for(int i = 0; i < n; i++)
{
cin >> a[i];
}
int temp;
for(int i = 0; i < n / 2; i++)
{
temp = a[i];
a[i] = a[n - 1 - i];
a[n - 1 - i] = temp;
}
for(int i = 0; i < n; i++)
{
cout << a[i] << " ";
}
cout << endl;
}