Question

c++ question. i need the code for this please

image.png

image.png

1 0
Add a comment Improve this question Transcribed image text
Answer #1

The output of the above code is 1.
Process-

The function d.print(n) is recursion with the base case of B::print(n) which print n.
So, the recursion is called in the following way-
recursion calls->
d.print(3) -> d.print(10) -> d.print(5) -> d.print(16) -> d.print(8) -> d.print(4) -> d.print(2) -> d.print(1) -> B::print(1) -> 1

Add a comment
Know the answer?
Add Answer to:
c++ question. i need the code for this please
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • c++ question. i need the code for this please

  • I really need help with the code for this, in C++ please, I know there's a...

    I really need help with the code for this, in C++ please, I know there's a similar question but the answer isn't correct :[ A palindrome is a string that reads the same forwards and backwards (ignoring spaces, punctuation, and capitalization). Examples are the familiar ``If I had a hi-fi,'' the grander ``A man, a plan, a canal, Panama,'' and ``Some men interpret nine memos.'' So the goal: Design, implement, document, and test a program that reads a line of...

  • they need matlab code please help i need the code i need picture for the graph...

    they need matlab code please help i need the code i need picture for the graph i need it as soon as possible

  • I need a matlab code for given question. Please send matlab code sctript. a:2 b:3: c:4...

    I need a matlab code for given question. Please send matlab code sctript. a:2 b:3: c:4 d:2.1 e:3.1 Question 1) (60 p) Consider following equation: axt-bx'+ex=dx-e Find the value of x via; a) Fixed Point iteration method with an accuracy of 0.0004 and a starting value of 1. b) Newton's Method with an accuracy of 0.0004 and a starting value of 1. Write the codes and the results to your paper.

  • I need help with the following question please in JAVA code. Hash code is used to...

    I need help with the following question please in JAVA code. Hash code is used to “encode” general keys into integers. One approach of creating a hash code is to use Java's hashCode() method. The hashCode() method is implemented in the Object class and therefore each class in Java inherits it. The hash code provides a numeric representation of an object (this is somewhat similar to the toString method that gives a text representation of an object). Write a program...

  • I need help solving this basic C++ question. I need help fixing my code.   Question: Design...

    I need help solving this basic C++ question. I need help fixing my code.   Question: Design a class called a box that represents a box. Box classes have variables such as the length of the box, width, and height. 1. Member variables shall be dedicated members. 2. Define the creator of the Box Class. The creator may receive all of the data and may not receive any. 3. Add accessor and creator 4. Add an empty function, which indicates whether...

  • Convert C to C++ I need these 4 C file code convert to C++. Please Convert...

    Convert C to C++ I need these 4 C file code convert to C++. Please Convert it to C++ //////first C file: Wunzip.c #include int main(int argc, char* argv[]) { if(argc ==1){ printf("wunzip: file1 [file2 ...]\n"); return 1; } else{ for(int i =1; i< argc;i++){ int num=-1; int numout=-1; int c; int c1;    FILE* file = fopen(argv[i],"rb"); if(file == NULL){ printf("Cannot Open File\n"); return 1; } else{ while(numout != 0){    numout = fread(&num, sizeof(int), 1, file);    c...

  • I want to this question solution by programming c code. I need this solution as soon...

    I want to this question solution by programming c code. I need this solution as soon as possible i have to submit this code after 24 hours. please someone help this question thanks :D Programming Question: (15pts) Assume a finite number of resources of a single resource type must be managed. Processes may ask for a number of these resources and will return them once finished. If all resources are in use the request is denied and the process terminates....

  • Please, I need help with program c++. This is a chutes and ladders program. The code...

    Please, I need help with program c++. This is a chutes and ladders program. The code must be a novel code to the specifications of the problem statement. Thank you very much. Assignment Overview This program will implement a variation of the game “chutes and ladders” or “snakes and ladders:” https://en.wikipedia.org/wiki/Snakes_and_Ladders#Gameplay. Just like in the original game, landing on certain squares will jump the player ahead or behind. In this case, you are trying to reach to bottom of the...

  • c++ i need the code for this problem please Write a program that gets 5 or...

    c++ i need the code for this problem please Write a program that gets 5 or more sets of information from user in this format First name last name Sex(Male –M, Female F) Age          Mellissa Henderson F 12       Marcus Cruz M 51       Anderson Mellissa F 19      Kenneth Lisa F 34       William Nancy F 24     Richard Eric M 69    Ronald William M 13    Christopher Elizabeth F 8    David Rodriguez M 11    Ryan...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT