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
What do you mean by algorithm​
Snowcat [4.5K]

A process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.

7 0
3 years ago
Read 2 more answers
Create a function named CountVowels() that takes one parameter name epsilon
LenaWriter [7]

def CountVowels(epsilon):

   countNum = 0

   for x in range(len(epsilon)):

       letter = epsilon[x]

       if letter.lower() in "aeiou":

           countNum += 1

   return countNum

def ExtractOdds(zeta):

   result = ""

   for x in range(len(zeta)):

       if x % 2 == 1:

           result += zeta[x]

   return result

sentence_A = input("Enter a sentence: ")

sentence_B = input("Enter a sentence: ")

print(CountVowels(sentence_A))

print(ExtractOdds(sentence_B))

I hope this helps!

5 0
3 years ago
Suppose a switch is built using a computer work station and that it can forward packets at a rate of 500,000 packets per second,
Marina86 [1]

Answer:

When the transmission exceeds 667 packets

Explanation:

In computer networking, a packet is a chunk of data transmitted across the network. The packet size of an Ethernet network is 1.5kilobytes, while the packet size of an IP packet payload is 64 kilobytes.

A switch is a physical network device that connects nodes or workstations while communicating the packets (or frames). The I/O bus size bandwidth is 1Gbps which allows approximately 667 packets. Once this packet size is crossed, the bus becomes a limiting factor or bottle neck.

3 0
3 years ago
Write your own Python or Perl script that carries out Base64 encoding. If you use the BitVector module, your solution should not
slavikrds [6]

Answer:

SORRRY IDK PLZ DONT JUDGE ME

Explanation:

3 0
4 years ago
Why was chess considered to be one of the most difficult games for computers to play well?​
telo118 [61]

Answer:

In a general sense, the answer to that is Go. The main reason for that is because the size of the board and the fact that it is empty to begin with gives the game a much more complex opening to the game. But if you were to make things equal in board size then chess is the obvious more difficult game to master.

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • Approximately what percent of U.S. businesses have some form of remote work program? (from Chapter 1)
    14·1 answer
  • If you notice files being transferred to or from your computer a. Simply close the window c. Tell the lab instructor b. Open a n
    11·2 answers
  • The main purpose of a service panel in a house is to
    11·1 answer
  • The scene of a human sitting at a computer terminal, responding to stimuli flashed on the computer screen, would most likely be
    7·1 answer
  • Why is it important to put the most specific case first? What types of errors does it help avoid?
    11·1 answer
  • Which orientation style has more height than width?
    11·1 answer
  • hey guys just dropped some hot beats so go and follow me my user is the beats and comment if you would do that that would be gra
    11·1 answer
  • Laura is filming a scene in which the subject is sitting with a lit fireplace behind him. The only other source of light in the
    15·1 answer
  • Q1) write a brief note on desktop computer.
    13·1 answer
  • write an expression taht evaluated to true if and only if the variable s does not contain the string 'end'
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!