A.
#include using namespace std; int main() { int a[10] = {1,2,3,4,5,6,7,8,9,10}; int begin = 0,end = 9; int tmp; while(begin < end) { tmp=a[begin]; a[begin]=a[end]; a[end]=tmp; begin++; end--; } for(int i=0;i < 10;i++) { cout << a[i] << ' ' ; } cout << endl; return 0; }
B.
#include using namespace std; int main() { int a[10] = {1,2,3,4,5,6,7,8,9,10}; int begin = 0,end = 9; int tmp; while(begin < end) { tmp=a[begin]; a[begin]=a[end]; a[end]=tmp; } for(int i=0;i < 10;i++) { cout << a[i] << ' ' ; } cout << endl; return 0; }
C.
#include using namespace std; int main() { int a[10] = {1,2,3,4,5,6,7,8,9,10}; int begin = 0,end = 9; while(begin < end) { a[begin]=a[end]; a[end]=a[begin]; } for(int i=0;i < 10;i++) { cout << a[i] << ' ' ; } cout << endl; return 0; }
D.
#include using namespace std; int main() { int a[10] = {1,2,3,4,5,6,7,8,9,10}; int begin = 0,end = 10; int tmp; while(begin < end) { tmp=a[begin]; a[begin]=a[end]; a[end]=tmp; begin++; end--; } for(int i=0;i < 10;i++) { cout << a[i] << ' ' ; } cout << endl; return 0; }