Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1-(a)- Write a function named powfun() thatraises an integer number passed to it

ID: 3609604 • Letter: 1

Question

1-(a)- Write a function named powfun() thatraises an integer number passed to it to a positive integer powerand displays the result. The positive integer should be the secondvalue passed to the function. Declare the variable used to storethe result as a long integer data type to ensure sufficient storagefor the result. b- Include the function written in (a) in a working program.make sure your function is called main(). Test the function bypassing various data to it. 1-(a)- Write a function named powfun() thatraises an integer number passed to it to a positive integer powerand displays the result. The positive integer should be the secondvalue passed to the function. Declare the variable used to storethe result as a long integer data type to ensure sufficient storagefor the result. b- Include the function written in (a) in a working program.make sure your function is called main(). Test the function bypassing various data to it.

Explanation / Answer

first you need to include the cmath directory by adding thefollowing command to the top of your program #include #include using namespace std; now for the function: long powfun(int num, int exp) {       long ans;    /*answer to be returned to main */       ans =pow(num,exp);       /* pow(a,b) isthe exponential operator in the cmath directory */       return ans; } now for the main function int main() {       int num, exp;       cout>num;       cout>exp;       long ans;       ans = powfun(num, exp);       cout