#include <iostream>
using namespace std;
// 输出函数
void myOut(int arr[]){
cout<<"[";
for(int i=0; i<6;i++){
cout<<arr[i];
if(i==5){
cout<<"]";
}else{
cout<<", ";
}
}
}
int main() {
int arr[6];
// 将用户的输入存入数组
for(int i=0; i<6;i++){
cin>>arr[i];
}
// 输出输入的原数组
myOut(arr);
int star = 0; //起始元素
int end = sizeof(arr)/sizeof(arr[0])-1; //末尾元素
int temp = 0;
// 开始调换
while(star<end){
temp = arr[star];
arr[star]=arr[end];
arr[end]=temp;
star++;
end--;
}
cout<<endl;
myOut(arr);
return 0;
}

京公网安备 11010502036488号