A function called sumofSeries that takes two parameters, the numbers x and n, and find the sum of the first n terms of the following series: x+(x +x2)+(x +x2 +x3)+ ....and return the result to the calling function. For example if x= 2 and n= 4, it should return:
2+(2 +22)+(2 +22 +23)+ (2 +22 +23 + 24) = 2+6+14+ 30 = 52 as the result.
Write the C++ statement(s) that invokes the function and the function definition for sumofSeries.