question - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

question

Panasonic99Panasonic99 Posts: 140Member
The user will enter: "C is fun!" and then presses enter then cntl-d?

(the isalpha() function will return a 1 if the character is between a-z or A-Z and a 0 otherwise. Hitting cntl-d is equivalent to 'EOF')

#include
#include
void main()
{
char ch;
int count = 0;
while ( (ch = getchar()) ! = 'EOF')
{
if (isalpha(ch))
count++;
}
printf("%d
", count);
}


Sign In or Register to comment.