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
USPshnik [31]
3 years ago
5

Complete the recursive function raisetopower(). ex: if userbase is 2 and userexponent is 4, then raisedvalue is assigned with 16

(i.e. 2^4). note: this example is for practicing recursion; a non-recursive function, or using the built-in function pow(), would be more common.
Computers and Technology
1 answer:
lesya [120]3 years ago
6 0
Using the property that x^n is x*x^(n-1) you can write a recursive function:

double raisetopower(double x, int n)
{
   if (n <= 0) {
      return 1.0;
   }
   return x*raisetopower(x, n - 1);
}

Note that this crude implementation does not deal with negative or fractional exponents. But it shows recursion.

You might be interested in
What do we call the two parts of lift that goes down a mine
Blababa [14]
The sheave wheel is a pulley wheel that sits above the mine shaft. The hoist cable passes over the sheave wheel and then down the shaft of the mine.
(copied from google)
4 0
3 years ago
Read 2 more answers
Data files whose records are always retrieved in sequence from the beginning of the file are known as
dimaraw [331]

Answer:

sequential files

Explanation:

Q:

Data files whose records are always retrieved in sequence from the beginning of the file are

A:

sequential files

3 0
2 years ago
Technological developments over the past two decades, such as the rise of the internet and email, have
enyata [817]
Change our live because....
7 0
3 years ago
Read 2 more answers
Do people answer questions more on this site or be on social more ??? no right or wrong answer your opinion
Sindrei [870]
It really depends on the person
3 0
3 years ago
When you tried to login to server your trail may faild this failure event is recorded in<br>​
julia-pushkina [17]
Real time not online time...
8 0
3 years ago
Other questions:
  • What is the absolute pathname of the YUM configuration file? REMEMBER: An absolute pathname begins with a forward slash
    12·1 answer
  • Who has access to the source code of proprietary software
    6·1 answer
  • A large institution, such as a bank, may have thousands of transactions to process in which no user interaction is required; whi
    5·2 answers
  • Define a new class Fighter that inherits from Spaceship. Add a variable property weapon that defaults to an empty string and a v
    14·1 answer
  • What is it called when you remove some information from a file or remove a file from the disk ? A) save b) delete c) edit d) rem
    5·1 answer
  • 9.A major step before taking print of the document is (3 points)
    14·1 answer
  • What makes jambinai so unique (it’s for band)
    10·1 answer
  • A fast way to add up a column of numbers is to click in the cell below the numbers and then: Click Subtotals on the Data menu. V
    6·2 answers
  • Write a program to assign and display a string value to any variable of your choice
    10·1 answer
  • What approach do you prefer to take when creating presentations for class projects? Would you rather use software or create pres
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!