code.cpp 411 B

12345678910111213
  1. /* Create a function that counts the number of times a
  2. * particular letter shows up in the word search.
  3. */
  4. using namespace std;
  5. int letterCounter(vector<vector<char>> arr, char c) {
  6. int mycount = 0;
  7. // loop over the array to get the count of each character array
  8. for (int i=0;arr.size()>i;i++){
  9. // add the count of "c" to count
  10. mycount += count(arr[i].begin(),arr[i].end(), c);
  11. }
  12. return mycount;
  13. }