//@Author Damien Bell
#include <iostream>

using namespace std;

int main(){
        
    const int size = 5;
    int array1[size]={0, 1, 2, 3, 4};//array1[0], array1[1], array1[2], array1[3], array1[4];
    int array2[size]={0};
    
    int i=5, j=0, k=0;//ignore me for now!
    
    /*   Reversing an array using for statements
    for(int i=0; i < size; i++){
        array2[i] = array1[size-i-1];
    }
    
    
    
    for (int i=0; i<5; i++){  // This outputs the first array
        cout << array1[i]<<endl;
    }
    
    cout <<endl<< endl;
    
    for (int i=0; i<5; i++){ // This outputs the second array
        cout << array2[i]<<endl;
    }
    */
    
    while (i>0){//Outer loop
        while(j < k){//Inner loop
            array2[j] = array1[i]; // Sets array 1 to the opposite part of array 2.
            j++; // increments the controller for the position in array 2
        }//Ends the inner loop
        k++; //Increments the controller for when the inner loop happens
        i--;//Decrements the outer loops counter
    }//ends the outer loop
    
    for (int i=0; i<5; i++){ // Outputs array 1
        cout << array1[i]<<endl;
    }
    
    cout <<endl<< endl; // Blank lines for formatting purposes.
    
    for (int i=0; i<5; i++){ //Output array 2
        cout << array2[i]<<endl;
    }
    
    
    
    
 return 0;
}
