#include
using namespace std;
int main() {
int arr[6] = { 0 };
int len = sizeof(arr) / sizeof(int);
for (int i = 0; i < len; i++) {
cin >> arr[i];
}
cout << "[";
for (int i = 0; i < len; i++) {
if (i == len - 1) {
cout << arr[i] << "]" << endl;
break;
}
cout << arr[i] << ", ";
}
// write your code here......
int temp,i;
for(i=0;i<(len+1)/2;i++){
temp = arr[i];
arr[i] = arr[len-1-i];
arr[len-1-i]=temp;
}
cout << "[";
for (int i = 0; i < len; i++) {
if (i == len - 1) {
cout << arr[i] << "]" << endl;
break;
}
cout << arr[i] << ", ";
}
return 0;
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)