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
Tcecarenko [31]
3 years ago
10

(C++) Write code to complete RaiseToPower(). Sample output if userBase is 4 and userExponent is 2 is shown below. Note: This exa

mple is for practicing recursion; a non-recursive function, or using the built-in function pow(), would be more common.4^2 = 16Given: #nclude using namespace std;int RaiseToPower(int baseVal, int exponentVal){int resultVal = 0;if (exponentVal == 0) {resultVal = 1;}else {resultVal = baseVal * //your solution goes here;}return resultVal;}int main() {int userBase = 0;int userExponent = 0;userBase = 4;userExponent = 2;cout << userBase << "^" << userExponent << " = "<< RaiseToPower(userBase, userExponent) << endl;return 0;}

Computers and Technology
1 answer:
Degger [83]3 years ago
5 0

Answer:

Following are the code to this question:

RaiseToPower(baseVal, exponentVal-1);//calling method RaiseToPower and in second parameter we subtract value  

resultVal = baseVal * RaiseToPower(baseVal, exponentVal-1);//defining resultVal variable that calculate baseVal and method value

Explanation:

In the above-given code inside the "RaiseToPower" method is defined that accepts two parameters, which are "baseVal and exponentVal" and inside the method, an integer variable "resultVal"  is defined, that holds a value that is 0.

  • In the next step, if the conditional statement is used, in if the block it checks the "exponentVal" variable value that is equal to 0, if it is true it assigns value 1 in "resultVal" otherwise it will go to else block in this block, the "resultVal" variable holds "baseVal" variable value and call the "RaiseToPower" method, and multiply the baseVal and method and store its value in resultVal and return the value.
  • Inside the main method, two integer variable userBase, userExponent is defined that holds a value and calls the above method and prints its return value.

please find the attachment of the code file and its output.

You might be interested in
What is Patch tool ???<br><br>​
AfilCa [17]

Answer:

<u><em>DEAR HERE IS YOUR ANSWER:</em></u>

<u><em>T</em></u>he Patch Tool is part of the healing brush set of tools. These are the go-to tools for retouching and repairing your images. The Patch Tool is primarily used to repair larger areas of an image, or get rid of any distractions or blemishes.

  • The patch tool was introduced into Photoshop at the same time as the Healing Brush
  • You don’t have to use the Patch tool to define a selection. You can use any selection tool and then select the Patch tool.  <em><u> </u></em>

<em><u>HOW TO USE PATCH TOOL IN PHOTOSHOP:</u></em>

  1. Click and hold the Healing Brush tool to select the Patch tool; on the Options bar, select the Destination radio button
  2. With the Patch tool still selected, drag to create a marquee around the source you want to use as the patch
  3. After you create the marquee, drag the selected source area to the destination to be repaired.

<em><u>I HOPE IT WILL WORK DEAR THANKS FOR ASKING  QUESTION</u></em>

Explanation:

4 0
3 years ago
Read 2 more answers
Finish the program by choosing the correct terms.
juin [17]
What are the exact numbers
6 0
3 years ago
Read 2 more answers
Monero is cryptocurrency that focuses on transparency of ownership. True or false
dangina [55]

Answer:

TRUE

Explanation:

4 0
3 years ago
Please help with this:
Tanzania [10]

Answer:

I'm not gonna give you the answer. I want you to think about this what is math, what is science, how does it help the world, and etc. These are some example questions to help.

Explanation:

5 0
3 years ago
What types of storage can be used to access data from another computer
Aleksandr-060686 [28]
<span>Hard disk drives
</span><span>RAM<span>Random access memory (RAM)
</span></span><span>External hard disks
<span>USB port
</span></span>CD and DVD drives
<span>Memory cards</span>
6 0
3 years ago
Read 2 more answers
Other questions:
  • 1. Why is it important to compare features of a computer before making a purchase?
    13·2 answers
  • "You are setting up a new subnetwork on an existing network. Management has asked that you use existing cabling that the company
    14·1 answer
  • All tif files start at offset 0 with what 6 hexadecimal characters?​
    11·1 answer
  • You have been asked to create a query that will join the Production.Products table with the Production.Categories table. From th
    6·1 answer
  • What is the WiFi signal strength in different iPhone models?
    7·1 answer
  • It is a small hand tool used generally in decorative works such as making garnishes
    15·1 answer
  • A ________ is a question you ask about data stored in a database
    9·1 answer
  • Jon wants to assign a value to the favorite food variable: favoriteFood! = "Pizza" but gets an error message. What does he need
    9·2 answers
  • A major public university graduates approximately 10,000 students per year, and its development office has decided to build a We
    10·1 answer
  • This is your code.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!