Write a function that counts the number of letters in the string using the following header:
int countLetters(const char s[])
Write a test program that reads a C-string and displays the number of letters in the string. Here is a sample run of the program:
```
```
#include
#include
using namespace std;
int countLetters(const char s[])
{
int count = 0;
for (int i = 0; i < strlen(s); i++)
{
if (isalpha(s[i])) count++;
}
return count;
}
int main()
{
// Prompt the user to enter a string
cout << "Enter a string: ";
char s[80];
cin.getline(s, 80);
cout << "The number of letters in " << s << " is " <<
countLetters(s) << endl;
return 0;
}
```
You might also like to view...
A cell ________ is a combination of the column letter and row number
A) filter B) criteria C) address D) citation
A(n) ____________________ is an error message displayed when the server experiences a serious problem and then stops functioning.
Fill in the blank(s) with the appropriate word(s).