1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include <iostream>
using namespace std;
int main()
{
const int ARRAY_SIZE = 7;
int array1[ARRAY_SIZE] = {4, 7, 2, 8, 1, 3, 0};
int array2[ARRAY_SIZE] = {0, 0, 0, 0, 0, 0, 0};
for(int frwd_indx = 0, rvrs_indx = (ARRAY_SIZE-1); frwd_indx < ARRAY_SIZE; frwd_indx++,rvrs_indx--)
{
array2[frwd_indx] = array1[rvrs_indx];
}
for(int x = 0; x < ARRAY_SIZE; x++)
cout << array2[x] << endl;
cout << endl;
return 0;
}
|