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
expeople1 [14]
3 years ago
14

Write biggerDigits.cpp that has a function called biggerDigits that uses two positive integer parameters with the same number of

digits and returns an integer whose digit in each position is the bigger of the two digits in that position in the input parameters. If a negative parameter is given, or if parameters with unequal numbers of digits are given your function can return any result of your choosing. Use recursion.
cout << biggerDigits(567, 765) << endl; // prints 767
cout << biggerDigits(123456, 444444) << endl; // prints 444456
cout << biggerDigits(999, 111) << endl; // prints 999
Computers and Technology
1 answer:
fomenos3 years ago
7 0

Answer:

Following are the program in the C++ Programming Language:

#include <iostream> //header file

using namespace std; //namespace

int biggerDigits(int n, int m) { //define function

if (n <= 0 || m <= 0) { //set if statement

return 0;  

}  

else { //set else statement

int a,b; //set integer variables

a = n % 10; //perform modulatio  

b = m % 10; //perform modulatio

int max = a; //set integer variable and assign value  

if (b > max) //set if statement

max = b; //initialize value to max

/*solution is here*/

return 10 * biggerDigits(n / 10, m / 10) + max;

}

}

int main() // main method  

{ // code is refer from question to make the program

cout << biggerDigits(567, 765) << endl; // call the function biggerdigits

cout << biggerDigits(123456, 444444) << endl; // call the function biggerdigits

//call function and print result

cout << biggerDigits(999, 111) << endl; // call the function biggerdigits

return 0; // return the integer 0

}

Explanation:

Here, we set the header file "<iostream>" and namespace "std" then, we set a function "biggerDigits()" and pass two integer type arguments inside it.

  • we set if condition in which when the variable "n" is less than equal to 0 or m is less than equal to 0 then, it return 0.
  • we set the else statement inside it we set two integer type variables "a" and "b" then, perform modulation with both the variables.
  • we set integer variable "max" and assign value of a in it.
  • we set if condition in which we check when the variable b is greater than variable max then, initialize the value of variable b in the variable max and return the solution through recursion.
You might be interested in
Explain how data is represent in the computer system
Alex Ar [27]

Explanation:

<h3>Computers use binary - the digits 0 and 1 - to store data. A binary digit, or bit, is the smallest unit of data in computing. It is represented by a 0 or a 1. Binary numbers are made up of binary digits (bits), eg the binary number 1001.</h3>

7 0
3 years ago
What value will be stored in the variable t after each of the following statements
olga55 [171]

Answer:

A) t = true

B) t = false

C) t = false

D) t = true

Explanation:

Part A, here 12 is greater than 1 so the condition is true.That is why "t" will hold "true".Part B, here 0 is not greater than 2 so this condition fails.Therefore "t" will hold "false" in this case.Part C,3*2=6 and we are comparing 5 with 6  Therefore condition fails here.That is why "t" will hold "false".Part D, here  we are comparing 5 with 5 and both are equal.So "t" will hold "true".

7 0
3 years ago
What should you do if you do not understand the directions on a test?
Cloud [144]

Answer:

ask your teacher for a little guidence.

Explanation:

even though you may not get the answer you need they might give you some assitance

3 0
3 years ago
Read 2 more answers
What are the two basic literary forms?
Korolek [52]
Fiction and nonfiction
6 0
3 years ago
What service uses a private cloud in conjunction with a web browser or downloaded client software to access desktop software?
dmitriy555 [2]

Answer:

The answer is Remote desktop services.

Explanation:

What service uses a private cloud in conjunction with a web browser or downloaded client software to access desktop software?

The answer is Remote desktop services.

Desktop virtualization is a software technology that separates the desktop environment and associated application software from the physical client device that is used to access it.

Desktop virtualization can be used in conjunction with application virtualization and user profile management systems, now termed "user virtualization", to provide a comprehensive desktop environment management system. In this mode, all the components of the desktop are virtualized, which allows for a highly flexible and much more secure desktop delivery model. In addition, this approach supports a more complete desktop disaster recovery strategy as all components are essentially saved in the data center and backed up through traditional redundant maintenance systems.

6 0
3 years ago
Other questions:
  • You work as a Network Administrator for Perfect Solutions Inc. The company has a Linux-based network. You have to create user ac
    12·1 answer
  • The efficiency of a screw is low because of _____. width friction length height
    10·2 answers
  • Write a program which will use a template version of search function(4 points): Randomly generate a list of 100 integers(1 point
    11·1 answer
  • The tools that cyber criminals often use, including computer viruses, worms, trojan horses and spyware, are called __________. q
    5·1 answer
  • A hierarchical addressing scheme is used
    15·1 answer
  • Select the organizational skills that can help with
    6·1 answer
  • What is wrong with the following declaration? How should it be fixed?
    11·1 answer
  • Write a function named remove_duplicates that takes a list (of numeric and/or string values) and returns a new list with only th
    9·1 answer
  • What are possible penalties if a designer is caught breaking copyright laws?
    13·1 answer
  • A) Write "T" for true statement and "F" for false statement.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!