For Cpp
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).
input code:
output:
code:
#include <iostream>
#include<math.h>
using namespace std;
/*make a function*/
bool check(double first,double second,double third)
{
/*if first of pow second == third than return true else
false*/
return pow(first,second)==third;
}
int main()
{
/*declare the variables*/
double first,second,third;
/*take user input*/
cout<<"Enter first number:";cin>>first;
cout<<"Enter second number:";cin>>second;
cout<<"Enter third number:";cin>>third;
/*call the function*/
cout<<"output:"<<check(first,second,third);
return 0;
}
Get Answers For Free
Most questions answered within 1 hours.