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
When you ask the database more complex questions using comparison operators, you are conducting a _____. sort questionnaire quer
Mice21 [21]
The correct answer is known as a "query".

When you ask a lot of complex questions , which uses comparison operators, that is called a query. A query refers to the <span>exact request for </span>data retrieval<span> with the use of database and information systems. </span>
8 0
3 years ago
What two Python data structures are already thread-safe, because they provide automatic support for synchronizing multiple reade
murzikaleks [220]

The  two Python data structures that are already thread-safe are list and tuples.

<h3>What are the data structures in Python?</h3>

Python is known to give room for its users to make  their own Data Structures.

It helps one to be able to  have total hold or control over their work or output functionality. Some key Data Structures are Stack, Queue, and others.

Learn more about Python from

brainly.com/question/26497128

#SJ1

6 0
2 years ago
01001000 01100101 01101100 01101100 01101111 00100000 01101101 01111001 00100000 01101110 01100001 01101101 01100101 00100000 01
Marianna [84]

You said Hello my name is REE

6 0
3 years ago
The Internet has been around for quite a while, but it did not have much impact on our everyday lives until the appearance of th
pishuonlain [190]

Answer:

The answer is "WWW".

Explanation:

WWW stands for World Wide Web, It is a combination of all Internet resources and users, that uses the hypertext transfer protocol. It provides world information that is available on the internet that is the expression of human knowledge. It is also known as a domain name that introduces resources or individual instances of the entire collection.

6 0
3 years ago
Which domain will redirect you to the amazon website?
Vinvika [58]

Answer:

Amazon.com

Explanation:

Every online business has a domain name that redirects to thier website usually has this format https:// of http:// followed by the domain name.

3 0
3 years ago
Other questions:
  • Excel assigns the name ____ to the first excel table created in a workbook.
    10·1 answer
  • Alright, so im currently trying to pass a computer science class. i need it done in a little under 2 weeks. Ill just ask the one
    5·1 answer
  • This loop is a good choice when you know how many times you want the loop to iterate in advance of entering the loop.
    14·2 answers
  • A painting company has determined that for every 115 square feet or wall space, one gallon of paint and eight hours of labor wil
    11·1 answer
  • What is the maximum current that should be allowed in a 5.0w 220 resistor?
    12·1 answer
  • How would you reduce or minimize the size of a "file"?
    5·1 answer
  • Which tab on the Ribbon contains the command to print a publication?
    10·1 answer
  • Your program has a loop. You want to exit the loop completely if the user guesses the correct word.
    6·2 answers
  • How to check the at&amp;t internet speed on my computer
    9·1 answer
  • Use the drop-down menus to describe the customize ribbon dialog box.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!