Think about the inverse logic. You should not be limiting yourself to the alphabet. Rather, count anything (besides ctrl) as characters and count words using whitespace.When I use switch-case, to output the amount of the characters I have to switch (c) for 26*2 times because of 26 upper and lower case letters. I wonder whether there is a better and more convenient way to solve this problem.
Following is my code(I didn't write down all cases for letters):
int sum1 = 0;
while((c = getchar()) != 4)
printf("The amount of characters:%d\n",sum1);