天天看點

C語言Matrix程式設計題——[Pointers and C-String]D. Liang 7.11 Counting the letters in a string

[Pointers and C-String]D. Liang 7.11 Counting the letters in a string

Description:

Write a function that counts the number of letters in the string using the following header:

Hint:

Don’t submit the main() function.

Programme:

//Date:2020/5/18
//Author:Kamenrider Justice
int countLetters(const char * const str)
{
   int length,i,count=0;
   length=strlen(str);
   for(i=0;i<length;i++)
   {
      if(isalpha(str[i]))
      {
         count++;
      }
   }
   return count;
}
           

Python大資料搜尋

繼續閱讀