Write a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements which lie on diagonals.
[Assuming the 2D Array to be a square matrix with odd dimension i.e., 3 x 3, 5 x 5, 7 x 7 etc….] Example, if the array content is
5 4 3
6 7 8
1 2 9
Output through the function should be:\
Diagonal One: 5 7 9
Diagonal Two: 3 7 1