Write the definition of a function that takes as input the three numbers. The function returns true if the first number to the power of the second number equals the third number; otherwise, it returns false. (Assume that the three numbers are of type double.)
The program runs and executes but after everything is done its only returning 0 and not true or false. Where could i be wrong please. thank you in advance. this is my code so far:
#include <iostream>
#include <math.h>
using namespace std;
class powers
{
private:
double num1;
double num2;
double num3;
public:
bool takeInput(double, double, double);
};
int main()
{
powers power;
double a;
double b;
double c;
cout << "please input first number: ";
cin >> a;
cout << "please input second number: ";
cin >> b;
cout << "please input third number: ";
cin >> c;
power.takeInput(a, b, c);
}
bool powers::takeInput (double num1, double num2, double num3)
{
double a;
double b;
double c;
num1 = a;
num2 = b;
num3 = c;
if (pow(a, b) == (c))
return true;
else
return false;
}