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
Ed wants to make sure that his system is designed in a manner that allows tracing actions to an individual. Which phase of acces
tatiyna

The phase of access control that one can say that Ed is more concerned about is called Accountability.

<h3>What is accountability?</h3>

Accountability is known to be one that removes the time and effort you that is used on distracting activities and a lot of unproductive behavior and it makes one to be more focused.

Hence, The phase of access control that one can say that Ed is more concerned about is called Accountability.

Learn more about Accountability from

brainly.com/question/27958508

#SPJ1

7 0
2 years ago
What is the recommended solution to configure this automated behavior? UC has a requirement that an opportunity should have a fi
Dmitry_Shevchenko [17]
The answer will need to be workflow.
8 0
4 years ago
Who initially developed what is now known as the internet?
Lyrx [107]

in 1990, when computer scientist Tim Berners-Lee invented the World Wide Web.

5 0
3 years ago
which type of classroom enables students to attend lectures without being physically present with the teacher
natka813 [3]
It should be high classed with a interesting pictures so students get attracted to listen
6 0
3 years ago
What should you point out when demonstrating 2023 murano’s xtronic cvt during full throttle acceleration?.
pav-90 [236]

The thing to point out when demonstrating 2023 murano’s xtronic cvt during full throttle acceleration are:

  • The fast response to its steering input.
  • The way or the level at which Murano stays when cornering.

<h3>What is  throttle acceleration?</h3>

Throttle response is known as vehicle responsiveness and it is one that often measures how fast a vehicle's internal combustion engine, can be able to increase its power output in regards to its response to a driver's need for acceleration.

Hence,The thing to point out when demonstrating 2023 murano’s xtronic cvt during full throttle acceleration are:

  • The fast response to its steering input.
  • The way or the level at which Murano stays when cornering.

Learn more about  throttle acceleration from

brainly.com/question/27962285

#SPJ1

3 0
2 years ago
Other questions:
  • Tanya has received an email, apparently from her bank, stating that some of her records were lost during server maintenance work
    13·2 answers
  • Controls that are used to assess whether anything went wrong, such as unauthorized access attempts, are called ________ controls
    5·2 answers
  • Anyone know the name of this font? and what site i can find it on so i can type it????
    8·1 answer
  • A powerful computer that acts as a hub for other computers is a called a ______.
    15·2 answers
  • Suppose we are working with an error-correcting code that will allow all single-bit errors to be corrected for memory words of l
    5·1 answer
  • 14.18 Lab 5d - Nested Looping Write a program that:
    10·1 answer
  • How did the new technologies of WWI affect soldiers fighting on the front lines? Please include at least three examples of new t
    5·1 answer
  • Your _______ can help block inappropriate content online.<br> 1. web browser<br> 2. Password
    14·1 answer
  • Which ipconfig command switch would a technician use to display detailed information (such as dns servers and mac addresses)?
    7·1 answer
  • Create a timeline of the evolution of computers and their impact on society
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!