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]
4 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]4 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
A low-level language has a low level of ___________ because it includes commands specific to a particular cpu or microprocessor
Studentka2010 [4]
Command Specifics to a cpu or a microprocessor it is code <span />
7 0
3 years ago
Select the online reading comprehension tool that best fits the description. This tool lets users change text from one language
Dmitrij [34]

Answer:

This tool lets users change text from one language to another.

translation tool

This tool helps users find definitions for difficult vocabulary.

online dictionary

This tool allows users to listen to passages of text that they select.

text-to-speech tool

This tool helps users memorize vocabulary by giving them representations of words using pictures.

flash cards

Explanation:

just did the assignment on edg 2020

7 0
3 years ago
Read 2 more answers
Which of the following is not considered format?
GalinKa [24]
The answer is indeed the last one, ordering information and let me say it is true because this describes a function in itself and not a format like the first option that is a text format, the second a visual format and the third could be a table format. I hope this clarifies things
6 0
3 years ago
Read 2 more answers
Why is the Operating System the most important system software in a computer?
OleMash [197]

Answer:

(Hope this helps can I pls have brainlist (crown)☺️)

Explanation:

The most crucial programme that runs on a computer is the operating system. It controls the memory and operations of the computer, as well as all of its software and hardware. It also allows you to communicate with the computer even if you don't understand its language.

An operating system is a piece of software that manages files, manages memory, manages processes, handles input and output, and controls peripheral devices like disc drives and printers, among other things.

7 0
3 years ago
Select the correct answer.
snow_tiger [21]

Answer: I think it's D.

Explanation: I'm sorry if I chose the wrong answer, I'm not too good with stuff like this.

3 0
2 years ago
Other questions:
  • What are the features that can extend record acees beyong Organization-wide defaults?A. Criteria-based sharing rules.B. Owner-ba
    12·1 answer
  • Your friend wants to know about Microsoft Expression Web 4. Which of the following terms will you use to describe Microsoft Expr
    5·1 answer
  • What does the e in email stand for
    8·2 answers
  • I am in desperate need to graduate. Overloaded with tons of online homework to be completed before the school year ends. I don't
    5·1 answer
  • When creating a documentary, what is not an appropriate source for footage?
    11·1 answer
  • Question 1 of 30
    13·1 answer
  • Why did they meet their friend<br><br><br><br><br><br><br><br>​
    8·2 answers
  • 1.) Explain one way the internet has impacted the way we behave.
    7·2 answers
  • Artificial intelligence (ai) in perspective is a complex and interdisciplinary field that involves several specialties, includin
    9·1 answer
  • If you want to load the "my-data.csv" file to Dataframe so that you can explore find out the number of data items in the data se
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!