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

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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
