text cover

Data Abstraction and Problem Solving with C++

Walls and Mirrors

by Frank M. Carrano

Addison Wesley Logo

c02p116.cpp

Go 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

Generated on Sun Aug 27 11:05:08 2006 for AWLogo by  doxygen 1.4.6