![]() |
Data Abstraction and Problem Solving with C++Walls and Mirrorsby Frank M. Carrano |
![]() |
c02p116.cppGo to the documentation of this file.00001 00015 // Exercise 1 00016 00017 int getNumberEqual(const int x[], int n, int desiredValue) 00018 { 00019 int count; 00020 00021 if (n <= 0) 00022 return 0; 00023 else 00024 { if (x[n-1] == desiredValue) 00025 count = 1; 00026 else 00027 count = 0; 00028 return getNumberEqual(x, n-1, desiredValue) + count; 00029 } // end if 00030 } // end getNumberEqual |