answer.
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
Paraphin [41]
1 year ago
8

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

s 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;
}
Computers and Technology
1 answer:
liberstina [14]1 year ago
3 0

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.

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

Download cpp
You might be interested in
Into which of these files would you paste copied information to create an integrated document?
Oksanka [162]
D cause you will need to keep up with data also
7 0
2 years ago
Read 2 more answers
Your company just bought a new subsidiary based in Des Moines, Iowa. Although your local operation already uses IPv6 for local n
AlexFokin [52]

Answer:

Answer explained below

Explanation:

Following are the arguments that can be used to persuade our colleagues in Des Moines to switch there network to IPv6 or to enable dual use of IPv6 and IPv4 :

  • IPv6 provides an increased capacity of address space as resources are efficiently allocated to provide coverage to additional web addresses.
  • IPv6 provides efficient routing by conveniently aggregating the prefixes that have been assigned to IP networks.
  • IPv6 conserves bandwidth by enabling large data packets. it uses less bandwidth than IPv4 for the same data.
  • IPv6 is more secure than IPv4 due to multiple security layers built in the firewall. It also provides authentication layers and integrity of data.
  • IPv6 supports multicast rather than broadcast.
  • IPv6 has more efficient packet processing and error detection through checksum as compared to IPv4.
  • Address and network configuration is fully simplified and automatic in IPv6 but the same is not true for IPv4.
  • IPv4 supports 32 bit IP address whereas IPv6 supports 128 bit. Therefore more number of IP addresses availability makes IPv6 future oriented.
6 0
2 years ago
2.32 LAB: Musical note frequencies On a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency o
Maurinko [17]

Answer:

#include<iostream>

#include<iomanip>

#include<cmath>

using namespace std;

int main()

{

float f0;

cout<<"Initial Frequency: ";

cin>>f0;

for(int n = 1; n<=5;n++)

{

 cout<<f0<<setprecision(2);

 f0 = f0 * pow(2.0,1.0/12);

 cout<<" ";

}

 

return 0;

}

Explanation:

The programming language is not stated; However, one can easily deduce that the program is to be written using C++

The following libraries enable the program to make use of some built in functions

<em>#include<iostream> </em>

<em>#include<iomanip> </em>

<em>#include<cmath> </em>

using namespace std;

int main()

{

This line declares the initial frequency as float

float f0;

This line prompts user for input

cout<<"Initial Frequency: ";

This line gets user input

cin>>f0;

The following iteration calculates and prints the frequency for thenexr 4 keys

<em>for(int n = 1; n<=5;n++) </em>

<em> { </em>

<em>  cout<<f0<<setprecision(2); </em>

<em>  f0 = f0 * pow(2.0,1.0/12); </em>

<em>  cout<<" "; </em>

<em> }  </em>

return 0;

}

7 0
2 years ago
1. Discuss why it is so important for all application builders to always check data received from unknown sources, such as Web a
Ivan

Answer:

1. It is so important for all application builders to always check data received from unknown sources before using that data. This is because of the Security related reasons and vulnerabilities .For example the data received might contain harmful hidden viruses.  Web applications are accessed by internet and these are the most vulnerable to attacks by hacker or intruders using harmful data containing malware. This can cause security breaches due to the security flaws or bugs in Web applications. So to overcome such security risks which can cause damage in the Web applications, data from unknown sources should be checked.

Explanation:

2. When the Website is being used and running, there is a room for possible glitches or other bugs and issues. To understand, handle and address  issues successfully, the website operators carefully and consistently patch and configure their systems. The administrators collect the user data which enables them to have enough data in order to make the requisite alterations or improvements in the website. This also helps to improve the website performance. The patching and configuring of systems fix problems in the website which reduces the risk of website damage and the website works smoothly this way. Moreover it identifies vulnerabilities, solve configuration issues and upgrades in website features provide additional capabilities to the website.

8 0
2 years ago
Acceleration is the rate at which an object changes its velocity. It is typically represented by symbol a and measured in m/s2 (
Natalija [7]

Answer:

<u>Pseudocode:</u>

INPUT velocity

INPUT time

SET velocity = 0.44704 * velocity

SET acceleration = velocity / time

SET acceleration = round(acceleration, 1)

PRINT acceleration

<u>Code:</u>

velocity = float(input("Enter a velocity in miles per hour: "))

time = float(input("Enter a time in seconds: "))

velocity = 0.44704 * velocity

acceleration = velocity / time

acceleration = round(acceleration, 1)

print("The acceleration is {:.2f}".format(acceleration))

Explanation:

*The code is in Python.

Ask the user to enter the velocity and time

Convert the miles per hour to meters per second

Calculate the acceleration using the formula

Round the acceleration to one decimal using round() method

Print the acceleration with two decimal digits

7 0
2 years ago
Other questions:
  • Graphical elements that precede each item in a list are known as​ __________.
    8·1 answer
  • ​identify a text-level element used to mark generic run of text within the document.
    15·1 answer
  • To gain experience of using and combing different sorting algorithms: election sort, insertion sort, merge sort, and quick sort.
    14·1 answer
  • Tina reported a safety hazard at her workplace to OSHA. Representatives from OSHA
    5·1 answer
  • Which of the registration patterns is best suited for complex architecture? A. Client side discovery pattern B. Third party regi
    13·1 answer
  • A few of your employees have complained that their computers sometimes shut down spontaneously. You have noticed that these empl
    6·1 answer
  • Write the routines with the following declarations: void permute( const string &amp; str ); void permute( const string &amp; str
    14·1 answer
  • To be eligible for the leadership training program offered by the office, a student must have at least 2 years of post-secondary
    9·1 answer
  • 9.6 Code Practice: Question 1
    9·1 answer
  • In the graph shown here, by what percentage are the number of people in computer occupations in general projected to increase?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!