1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
PtichkaEL [24]
3 years ago
12

Write the definition of a function that takes as input the three numbers. The function returns true if the first number to the p

ower of the second number equals the third number; otherwise, it returns false. (Assume that the three numbers are of type double.)

Computers and Technology
1 answer:
sattari [20]3 years ago
3 0

Answer:

I am writing a C++ program.

Here is the function CheckPower() which is a bool return type function which means it will return either true of false. This function has three double type parameters. This function returns true if the first number to the power of the second number equals the third number; otherwise, it returns false.

bool CheckPower(double number1, double number2, double number3)

{

   double power; // stores value of number1 to the power number2

   power = pow(number1,number2); // pow() function to computer power

   if (power==number3) // if the value of power is equal to third no number3

       return true; // returns true

   else // if above condition evaluate to false then returns false

       return false;

}

Explanation:

Lets take the values of number1 = 3, number2 = 2 and number3 = 9 to understand the above function.

The pow() function is a power function to calculate the result of number1 raised to the power of number2. Here number1 is the base number and number2 is exponent number. As number1 = 3 and number2 = 2 so this is equivalent to 3² . So 3 raise to the power 2 is 9. The value stored in power is 9.

power = 9

Next, the if condition checks if the value in power is equal to the value of number3. The value of number3 is 9 and the value in power variable is also 9 so the If condition evaluates to true. So the if part is executed which returns true.

If the value of number3 is, lets say, 10 then the If condition evaluates false as the value of power is not equal to value of number3. So the else part is executed which returns false.

If you want to see the output of this function you can write a main() function as following:

int main()

{   double num1, num2, num3;

   cout << "enter first number: ";

   cin >> num1;

   cout << "enter second number: ";

   cin >> num2;

   cout << "enter third number: ";

   cin >> num3;

   if(CheckPower(num1, num2, num3))

   { cout<<"True";    }

   else

   { cout<<"False";  }    }

This is a main() function which asks the user to enter the values of three numbers num1, num2 and num3. The if condition calls CheckPower() function to check if the first number to the power of the second number equals the third number. If this condition evaluates to true, the message True is displayed on the screen otherwise message False is displayed on output screen.

The screen shot of program along with its output is attached.

You might be interested in
For any element in keysList with a value smaller than 40, print the corresponding value in itemsList, followed by a comma (no sp
givi [52]

Answer:

u look se33y yessir

Explanation:

......................................

7 0
2 years ago
How many levels of full body protective clothing are there? A. Four B. Seven C. Six D. Two
Verdich [7]
The answer is A. Four
4 0
3 years ago
Read 2 more answers
Understanding the link between education and your desired career is an integral part of your career _______.
34kurt
I'm not 100% sure about my answer but based on articles I read online it makes the most sense to me.

Understanding the link between education and your desired career is an integral part of your career EXPLORATION.

The first step in career exploration is that you need to ask yourself this question "What can I do with this major?". If you have your answer, it is best to start exploring the connections that links your academic and professional interest.
7 0
3 years ago
Read 2 more answers
What is the missing part to have the output as 3 2 1 while count &gt;0 : print(count) count -= 1
Natali [406]

Answer:

Explanation:

16

6 0
2 years ago
Your uncle spent most of his teen years in a hospital undergoing treatment for a severe physical illness. As an adult, he is rat
ziro4ka [17]

Answer:

one-dimensional

Explanation:

According to my research on studies conducted by psychologists, I can say that based on the information provided within the question I can say that the theory or model of what caused his phobia is one-dimensional. This can be said because by growing up in a single closed environment he does not have experience when finally being part of society, therefore his personality or characteristics are one-dimensional.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

7 0
3 years ago
Other questions:
  • 1) If a client requests timestamping every two minutes, how would it look? a) [00:02:00] b) [00:06:00] c) (00:04:00)
    15·2 answers
  • Which version of Windows was considered an operating environment rather than an operating system? Windows 1.0 Windows 3.0 Window
    9·1 answer
  • 3. What are the first steps that you should take if you are unable to get onto the Internet? (1 point)
    15·1 answer
  • The following relation schema can be used to register information on the repayments on micro loans.
    13·1 answer
  • Which staff member takes a set of plans and supervises their construction?
    6·1 answer
  • س2) اکتب خوارزميه لحل المعادلة الرياضيه الاتيه
    9·1 answer
  • Help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!​
    9·1 answer
  • What is a personal data?
    12·1 answer
  • 1. Name the three kinds of Eraser in Photoshop. <br>​
    8·2 answers
  • A program that organizes sequences of automated provisioning tasks. A. Application Packager B. Sequence Manager C. Sequence Logg
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!