#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 40001;
int a[N] = {1,2,3,4,5,6,7,8,9,0};
int main()
{
// ----------检查数组里前N的内容-------------------
for (int i = 0; i < 10; i++)
{
cout << a[i] << ' ';
}
cout << endl << endl;
// -----------实现顺序表逆转----------------
for (int i = 0, temp = 0; i < 10/2; i++){
temp = a[i];
a[i] = a[9 - i];
a[9 - i] = temp;
}
// -----------输出顺序表-------------------
for (int i = 0; i < 10; i++) cout << a[i] << ' ';
return 0;
}
顺序表逆转
于 2023-09-19 22:47:54 首次发布