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:
```

Enter a string: 2010 is coming
The number of letters in 2010 is coming is 8
```


```
#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;
}
```

Computer Science & Information Technology

You might also like to view...

The basic input/output system (BIOS) is stored on a ________ chip

A) RAM B) CMOS C) ROM D) CPU

Computer Science & Information Technology

When a slide is appropriate in a presentation but not suitable for the current audience the slide should be hidden

Indicate whether the statement is true or false

Computer Science & Information Technology

The Edit command allows you to change multiple occurrences of the same text in a presentation

Indicate whether the statement is true or false

Computer Science & Information Technology

Which of the following is NOT a medium used for storing digital images?

a. Internal memory b. SD card c. CompactFlash card d. None of the above

Computer Science & Information Technology