Question: C++ problem. Answer must use Recursion Expected output : 20 24 14 Write a function int numLegs(char animalsl. int numAnimals). It should take the array

C++ problem. Answer must use Recursion

Expected output :

20 24 14

C++ problem. Answer must use Recursion Expected output : 20 24 14

Write a function int numLegs(char animalsl. int numAnimals). It should take the array animals, which will consist only of the chars 'c' and'd' representing "cow" or "duck" and calculate the total number of legs those animals have (assume no mutations or industrial accidents... a cow has 4 and a duck has 2). Note that the function is declared above main but you will implement it at the bottom of the code (after loops have been disabled). Code: 1 #include #include 3 using namespace std; 6 int numLegs (char animals, int numAnimals); 8 int main) 10 char farml-c','d, d','c,c,c' 12char farm2-d,'d.c'.c,c,'d',d,d, 'd'; 13char farm3-,'d','d',d','d', 'd'>; 14 15 16 17 18 19 20 21 //Disable iterative looping structures.. 22 define for 23 #de fine while "GetThatOutOfMyKitchen" 24 #define goto 25 26 //Do not modify anything on or above the line below this 27/YOUR CODE BELOW 28 29 30 31 //YOUR CODE ABOVE 2 //Do not modify anything on or below the line above this cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!