Write code to complete RaiseToPower(). Sample output if userBase is 4 and userExponent is 2 is shown below. Note: This example is for practicing recursion; a non-recursive function, or using the built-in function pow(), would be more common.
4^2 = 16
#include
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(void) {
int userBase = 0;
int userExponent = 0;
userBase = 4;
userExponent = 2;
printf("%d^%d = %d\n", userBase, userExponent, RaiseToPower(userBase, userExponent));
return 0;
}

Answers

Answer 1

Answer:

Replace /* Your solution goes here */ with

RaiseToPower(baseVal, exponentVal-1);

Explanation:

From the question, we understand that the program uses recursion.

The essence of recursion is to call a function from the function itself.

This is done by RaiseToPower(baseVal, exponentVal-1);

Because it passed the baseVal and the exponentVal reduced by 1 to the RaiseToPower function.

This is repeated until exponentVal = 1.

However, I've added the full program as an attachment where I used comments to explain some lines.

Answer 2

In this exercise we have to use the knowledge of computational language in C++ to write the code.

This code can be found in the attached image.

To make it simpler the code is described as:

#include<iostream>

#include<stdio.h>

int RaiseToPower(int baseVal, int exponentVal){

int resultVal = 0;

if (exponentVal == 0) {

resultVal = 1;

}

else {

resultVal = baseVal * RaiseToPower(baseVal, exponentVal-1);

}

return resultVal;

}

int main(void) {

int userBase = 0;

int userExponent = 0;

userBase = 4;

userExponent = 2;

printf("%d^%d = %d\n", userBase, userExponent, RaiseToPower(userBase, userExponent));

return 0;

}

See more about C code at brainly.com/question/19705654

Write Code To Complete RaiseToPower(). Sample Output If UserBase Is 4 And UserExponent Is 2 Is Shown

Related Questions

which of the following reflects the order of operations

Answers

Answer: PEMDAS

Parenthesis, Exponents, Multiplication, Division, Addition, Subtraction

Explanation:

pemdas .. parentheses , exponents , multiply , divide , add , subtract.. DO THAT IN ORDER

What is the output?
numB = 25
while numB > 13:
numB = numB - 5
print(numB)
Output:

Answers

Answer:

The answer is 10

Explanation:

i got it right on the assignment

Answer: 10

Explanation: got it right on edgen

in what domain electrica energy is the most use

Answers

Answer:the main signal bearing entities are voltage and their current in circuit environments.

Explanation:

The file includes 4993 tweets including the keyword 'election'. Each tweet is represented in a separate line. Write a program to open the file and read through its lines, then only if a tweet includes a hashtag (a term beginning by the

Answers

Answer:

import re

with open("../../Downloads/Tweets.txt","r", encoding="utf-8") as tweets:

   myfile = tweets.readlines()

   for item in myfile:

       item = item.rstrip()

       mylist = re.findall("^RT (.*) ", item)

       if len(mylist) !=0:

           for line in mylist:

               if line.count("#") >=1:

                   ln = line.split("#")

                   dm = ln[1]

                   print(f"#{dm}")

Explanation:

The python source code filters the document file "Tweets" to return all tweets with a hashtag flag, discarding the rest.

ANIMATION QUESTION

In the you tube animation "The Heavy Is Ded" the Heavy is supposedly "Ded" but throughout the video, he clearly isn't ded, can anyone explain how on earth this is possible, because this should be impossible since the Heavy is ded

Answers

Answer:

I think my old acc got deleted again..........

Explanation:

I love u here is a meme

Write a function writel that will write the length of a side of a square. If only one argument is passed to the function, it is the length, and the output will go to the Command Window. If two arguments are passed, however, the first argument will be the length and the second argument will be the file identifier for an output file to which the length should be printed.

Answers

def writel(length, file_name = ""):

   if file_name!="":

       f = open(file_name, "w")

       f.write(str(length))

       f.close()

   else:

       print(str(length))

writel(3, "FileName.txt")

I hope this helps!

Remember, you must have the file created prior to running this program. Best of luck.

Answer: Answer to this question for MatLab

Explanation:

function out = write1(length,varargin)

if nargin == 1

   disp(length)

end

if nargin == 2

   fid = fopen(varargin{1},'w');

   fprintf(fid,'%d',length) %

   fclose(fid);

end

end

%varargin{1} needs to be the name of a file you already created

Program that take 3 number and display them in ascending order c++

Answers

Answer:

#include <iostream>     // std::cout

#include <algorithm>    // std::sort

#include <vector>       // std::vector

using namespace std;

int main()

{

   vector<int> myvector{ 8, 1, 3 };

   std::sort(myvector.begin(), myvector.end());

   for (int x : myvector)

       cout << x << " ";

}

Explanation:

Use STL libraries where you can to keep your code robust!

How many RTTs does it take until the sender's congestion window reaches 2M bytes? Recall that the congestion window is initialized to the size of a single segment, and assume that the slow-start threshold is initialized to a value higher than the receiver’s advertised window.

Answers

The question is incomplete, Below is the complete question.

Suppose that you are using an extended version of TCP that allows window sizes much larger than 64K bytes.1 Suppose you are using it over a 1Gbps link with a round-trip time (RTT) of 200ms to transfer 16M-byte file, and the TCP receiver's advertised window is 2M bytes. If TCP sends 1K-byte segments, and assuming no congestion and no lost segments:

(a) How many RTTs does it take until the sender's congestion window reaches 2M bytes? Recall that the congestion window is initialized to the size of a single segment, and assume that the slow-start threshold is initialized to a value higher than the receiver’s advertised window.

(b) How many RTTs does it take to send the file?

(c) If the time to send the file is given by the number of required RTTs times the RTT value, what is the effective throughput for the transfer? What percentage of the link capacity is utilized?

Answer/Explanation:

(A)

When;

RTT0 = 1KB

RTT2 = 4KB

RTT1 = 2 KB

RTT3 = 8KB

RTTn = 2nKB.......

We need n = 11 to have 2 MB = 211.

With that, the window size will become 2MB after 11 RTTs.

(B)

By the 11th RTT 2MB have been transmitted and the window is 2MB, then, by the end of the 12th RTT,2MB have been transmitted and the window is now 2MB. Similarly during the next 3 RTTs, another 2MB will be transmitted, 4MB and another 2MB, thus 15 RTTs is needed to transmit the entire file.

c) Effective throughput for the transfer is the file size over the needed time i.e,

= 8 * 16Mb / (15 * 200 * 10-3)

which is;

= 144 / 3000 * 10-3

Then;

= 144 * 103 / 3000

And;

= 48 Mbps(Megabit per second)

Bandwidth Utilization = effective throughput / Available link speed

= 48 / 1024

= 0.0468

= 4.68 %

MB = MegaBytes

while

Mb = Megabits

The replacement policy that can be implemented in practice and performs the best among the replacement policies that can be actually coded is:

Answers

Answer:

The answer is "Least recently used policy".

Explanation:

It is the page replacement policy, which uses a less frequent substitute.  It adds a registry from each frame that includes the last time the program, that views within the frame, and use a "logical clock" for each of the data references, that made to change by a tick.

This replacement strategy is often used to substitute its least currently utilized cache line or page, and it is realistic and best implemented among the substitution policies.

Kristen wants to view the records of her database in ascending order. What should she do?
OA. Index the report
OB. Create a table
OC. Sort the table
OD. Create a report

Answers

the answer is Sort the table

The answer is OC. Sort the table

What is the size of an iPad Air 2 when rotated

Answers

size of ipad air 2 is 360degree

I believe it’s 360 like the person above me said

True or False:

You can convert your PowerPoint presentation in web pages.

Answers

Answer:

true

Explanation:

True because a powerpoint can be opened online ( on a webpage) as well

the celestial sphere is divided into
1. 88 different areas that identify, name, and plot the celestial objects.
2. 44 different areas that identify, name, and plot the celestial objects.
3. 22 different areas that identify, name, and plot the celestial objects.
4. constellations, such as Orion, Rigel, and Sirius

Answers

Answer:

A.

Explanation:

The answer is 1. or A.

PLEASE HELP ASAP! BRAINLIEST TO BEST ANSWER!
Use the drop-down menus to set a password to encrypt a presentation.


1. Save a backup copy of the original file.


2. Go into the (A. Home tab, B. Trust canter, C. Backstage view) in the File tab, and select ( A. Check for issues, B. Protect presentation, C. Presentation permissions)

3. Type in a password. Then, (A. Reenter, B. Strengthen) the password, and save the new file.

4. Keep the password in a safe place.

Answers

Answer:

1. Save a backup copy of the original file.

2. Go into the  ✔ Backstage view  in the File tab, and select  ✔ Protect Presentation .

3. Type in a password. Then,  ✔ reenter  the password, and save the new file.

4. Keep the password in a safe place.

Explanation:

The password to a presentation for encryption is added from the backstage view of the file tab with to protect prestation option.

Why to encrypt a presentation?

The encryption to a presentation is given as the setting of password to open it in order to protect the data, and enhance the security of it.

The encryption to the presentation is performed with the following steps:

A backup copy of the original question is saved.In the backstage view of the file tab, protect presentation option is selectedThe password is typed, and then reentered to save the new file.The password is kept at the safe location.

Learn more about presentation, here:

https://brainly.com/question/14621266

#SPJ2

Do you think the divide will fade in time. Write your opinion.

Answers

Hello. Your question is incomplete and without context, which makes it impossible for it to be satisfactory and satisfactory. However, I will try to help you in the best possible way.

For you to have an opinion on whether the division may disappear over time, you must analyze the composition of that division and how it was created, based on this analysis, you can reflect on whether the composition of the division in the environment in which it is located is likely to be temporary, or if it is impossible to determine the period of time for which it will remain active.

Suppose we have a 4096 byte byte-addressable memory that is 32-way high-order interleaved, what is the size of the memory address module offset field?

a. 10

b. 7

c. 5

d. 4

Answers

Answer:

7

Explanation:

Given that :

Byte-addressable memory = 4096

Order = 32

Rwqritying such that they have the same base ;

4096 = 2^12

32 = 2^5

2^12 - 2^5

12 - 5 = 7

Which Tab contains the paragraph attributes?

A. Home
B. Insert
C. Review
D. View

PLs help
Award: 15pts

Answers

Answer:

Insert

Explanation:

To create an SSL connection, a Web server requires a ________, which is an electronic document that confirms the identity of a website or server and verifies that a public key belongs to a trustworthy individual or company.

a. DSL Degree
b. SSL Degree
c. SSL Certificate
d. DSL Certificate

Answers

Answer:

c. SSL Certificate

Explanation:

The full form of SSL is Secure Sockets Layer. It is the standard security technology which establishes the encrypted link between a client and the server—typically a web server (which is the website) and the browser, or the mail server along with a mail client (for e.g., Outlook).

In the context, in order to develop an SSL connection, an SSL Certificate is required by the Web server.

by what other name can the folders in Windows 7 be called?

Answers

I think document folder

The other name for the folders in Windows 7 be called as Directories.

What is Windows 7?

The Windows 7 operating system (OS) was made available for purchase in October 2009 to replace Windows Vista. Windows 7 was created as an update to the Windows Vista operating system and is based on the Vista kernel. It makes use of Windows Vista's original Aero user interface (UI).

The folder of the Windows 7 is also called as files, other folders, directory etc.

Additionally, folders enable you to have several files with the same name. The person might have a file named Resume.doc in your My Documents folder and a different file named Resume.doc in a folder called Resume templates, for example. Every file would require a distinct file name if they were all in one location.

Therefore, it can be concluded that The other name for the folders in Windows 7 be called as Directories.

Learn more about Windows 7 here:

https://brainly.com/question/1285757

#SPJ2

Derek has to create a technical design of a complex floor plan using CAD. What will be most helpful for Derek to use to create the design?
OA layers
OB. scale
O c. units
OD. file formats

Answers

Answer: A: Layers

Explanation: It is correct on PLATO

Why do people create web pages?

Answers

Answer:

To grab peoples attention

Explanation:

Answer:

People create web pages to share their passion for whatever they do. People create them to sell buisness products too.

Explanation:

I hoped this helped.

Corey set up his presentation for delivery to his team.

Answers

Answer:

If Corey wants to control the pacing of his presentation, he should adjust his playback settings. In the playback settings, he should select the default setting under "type;" this will allow him to change slides anytime. He should also click the check box under "options" that says "Change slides manually" so he can simply click on the slide whenever he is ready to move on to another slide.

Explanation:

If you don't like that answer, here's another one:

Corey knew he would need a lot of time to explain each point and that his team members would have lots of comments and questions. The best way that Corey should set up his slide show would be to make sure that he has an outline. Also, there should only be one thought per slide (never mix it). It has to be taken into account that he should have fewer words and more images/graphs.

HOW TO BE A EXPRET PLAYING AMONG US

Answers

Answer:

Just keep playing

Explanation:

That’s so how

Answer:

If inposter look afk and they will think you are afk and vote everyone else out

(;

Help quickly!!

Output: Your goal
You will write a program that asks a user to fill in a story. Store each response in a variable, then print the story based on the responses.

Part 1: Plan and Write the Pseudocode
Use the following guidelines to write your pseudocode for a fill-in story program.

Decide on a list of items the program will ask the user to input.
Your program should include at least four interactive prompts.
Input from the user should be assigned to variables and used in the story.
Use concatenation to join strings together in the story.
Print the story for the user to read.


Write your pseudocode here:











Part 2: Code the Program
Use the following guidelines to code your program.

Use the Python IDLE to write your program.
Using comments, type a heading that includes your name, today’s date, and a short description.
Set up your def main(): statement. (Don’t forget the parentheses and colon.)
Conclude the program with the main() statement.
Include at least two print statements and two variables.
Include at least four input prompts.
Use concatenation to join strings.
Follow the Python style conventions regarding indentation in your program.
Run your program to ensure it is working properly. Fix any errors you may observe.

please help me I don't know what code to type in.

Answers

def main():

   name = input("Enter your name: ")

   age = input("Enter your age: ")

   color = input("Enter you favorite color: ")

   birth = input("Enter your birthday: ")

   print(name + " is "+age+" year(s) old.")

   print(name + "'s favorite color is "+color)

   print(name + " was born on "+ birth)

main()

I hope this helps! The code runs perfectly fine for me.

In this exercise we want to write a pseudocode, so this way we will find how:

the code is in the attached image

What is pseudocode?

Pseudocode is a generic way of writing an algorithm, using a simple language (native to whoever writes it, so that it can be understood by anyone) without the need to know the syntax of any programming language.

To make it simpler to copy the code is below as:

def main():

  name = input("Enter your name: ")

  age = input("Enter your age: ")

  color = input("Enter you favorite color: ")

  birth = input("Enter your birthday: ")

  print(name + " is "+age+" year(s) old.")

  print(name + "'s favorite color is "+color)

  print(name + " was born on "+ birth)

main()

See more about pseudocode at brainly.com/question/13208346

Can someone please help me?m

Answers

Answer:

(_(

Explanation:

Protected members of a base class are like ________, but they may be accessed by derived classes. a. constructor functions.b. static members.c. private members.d. public members e. none of these.

Answers

Answer:

C). private members

Explanation:

These are options

a. constructor functions

b. static members

c. private members

d. public members

Protected members can be regarded as member that accessibility of them from outside the class is zero, they can only get accessibility from derived classes, though this is not applicable to private class. It should be noted that Protected members of a base class are like private but they may be accessed by derived classes.

What is output? Select all that apply.
C = 0
while (c 10):
C = c + 5
print (c)

Answers

Answer:

The answer is:

5

10

Explanation:

In the while loop, we specify, if C is not equal to 10, C += 5 and print(c). When python reads the loop, python will check to see if C is equal to 10 and if not it will add 5 until C is more than or equal to 10. In addition, python will print(c) to the console until it hits 10. Once C is less than or equal to 10 the loop will stop. In this scenario, since we print c in the loop, the codes output will be the following:

5

10

hope this helps :D

Do you think the divide will fade in time? Write your opinion

Answers

Answer:

The answer is "true".

Explanation:

When ICTs are becoming more daunting and easier, that violation may eventually subside. However many people have reasons to believe that even in fact the racial literacy will persist, and even grow.  

It is constantly shrinking by 5% every year in terms of raw figures, and increasing estimates show that just by 2028 100% of the world's population will have access to the internet.

What are two options available for highlighting changes in the Highlight Changes dialog box?
A) for a specific website or by a specific user
B) by a specific user or in a specific file format
C) in a specific file format or for a specific website
D) within a specific time period or by a specific user

Answers

Answer: D

Within a specific time period or by a specific user

Explanation:

Answer:

D)

Explanation:

within a specific time period or by a specific user

Which of the following features can be found on the LMS home page?
(Select all that apply.)
A. Log in to the LMS
B. Review the FTI calendar
C. Acces the FAQs
D. Watch videos
E. Follow FTI social media

Answers

A b c d e so yes it need 20 words for this lol
Other Questions
what is the purpose of work teams ? I need help with number 3 it would be awesome if someone could help me Circle a has area 500 in the diameter of circle b is three times the diameter of circle a estimate the area of circle b how do answer my question Why are you bad (poor) in Nepali/English/Math,....? Give your own opinion How did Moses respond when God called his name?a.He turned aside to look.b.He kept the flock of Jethro.c.He appeared in a burning bush.d.He said, Here am I. Can somebody help me please The scores of nine students in a mathclass were 74, 96, 75, 43, 100, 89,62, 85 and 52. Find the range andmedian of the scores. What are comets? please type with your own words What was the cause of the Second Crusade?Seljuks took control of the settlement of Edessa.Seljuks stopped allowing visits to the Holy Land.Crusaders founded more settlements in the Holy Land.Crusaders took control of the city of Jerusalem. Which situation describes a car that can travel 40 miles per gallon of gasoline?AA car can travel 2 miles on 80 gallons of gasoline.BA car can travel 42 miles on 2 gallons of gasoline.CA car can travel 80 miles on 2 gallons of gasoline.D A car can travel 80 miles on 40 gallons of gasoline. BRAINLIEST nvbfnytkuyguhmghmbfkuiyjyg what is the value of b Match each vocabulary word with the correct definitionethnocentrismof higher rank, greater importance, orbetter qualityimperialismthe belief that Darwin's theories could beapplied to human social structuresnationalisma belief that one's country is superior,extreme patriotismsocial Danvinismone country's political, economic, andsocial domination of anothersuperiora belief in the superiority of one'sethnicity or culture What is badi door se aya hai? i will mark brainiest? Emma decided to bake cookies. Her recipe called for 3 cups of sugar and 4 cups of chocolate chips for 2 batches of cookies. If she made 12 batches of cookies, how many cups of chocolate chips does Emma need? Which rights does the Declaration of Independence list as unalienable? health, wealth, and the defense of one's possessions life, liberty, and the pursuit of happiness consent, cooperation, and representation in government property, prosperity, and treatment with respect What is the zero of r(x) = 5x - 3? HELPPPP PLEASEEE A squirrel falls from this tree after being shocked by the falling apples. If thesquirrel was 3.5 meters above the ground, how long until the squirrel hits theground? Item 19Question 1A person hikes 4 miles in 2.5 hours. Find the unit rate in miles per hour.A person hikes 4 miles in 2.5 hours. Find the unit rate in miles per hour.