Problem: write a function named powfun() that raises an integer number passed to it to a positive integer power and displays the result. The positive integer should be the second value passed to the function. Declare the variable used to store the result as a long integer data type to ensure sufficient storage fo rthe result. My interpretation program of this problem is as follows;
[#include <iostream>
using namespace std;
int Powfun(long int);
int main ()
{
int value = 0;
long int x = 2*exp((.02*(4)));
if (value <= 0);
else
value = x;
return (x);
cout << " the exponent value of " << x
<< "is " << x << endl;
cin.ignore();
return 0;
}
int Powfun(long int x);
]
please help because this program is receiving build errors and I do not know for sure if I have the right code to address the problem
I think the problem wants you to write a function named powfun that actually does something. What you did was to let the main function do all the work.
#include <iostream>
//forgot to include cmath
usingnamespace std;
int Powfun(longint); //read the problem, it states: The positive integer should be the
//second value passed to the function.
int main ()
{
int value = 0;
longint x = 2*exp((.02*(4))); //exp is not the function to use the problem asks that
//you throw two arguments to the function. I suggest
//reading about the pow() function.
if (value <= 0);
else
value = x;
return (x); //main will exit here.
cout << " the exponent value of " << x //This section of the code is unreacheable
<< "is " << x << endl;
cin.ignore();
return 0;
}
int Powfun(longint x); //another prototype? You'll need to implement the function here.