#include #include int main() { char line[80] = "This is !$ some text"; strcat(line," and this is a bit @more"); strcat(line," here is some 12345 punctuation .,;:"); int ndigits = 0; int nvowels = 0; int nconsonants = 0; int npunctuation = 0; int nthrerest = 0; int nblank = 0; int i; int l; char c; l = strlen(line); printf(" %4d characters in the line \n",l); for (i = 0; i < l; i++) { c = line[i]; switch (c) { case 'a': case 'A': case 'e': case 'E': case 'i': case 'I': case 'o': case 'O': case 'u': case 'U': nvowels++; break; case 'b': case 'B': case 'c': case 'C': case 'd': case 'D': case 'f': case 'F': case 'g': case 'G': case 'h': case 'H': case 'j': case 'J': case 'k': case 'K': case 'l': case 'L': case 'm': case 'M': case 'n': case 'N': case 'p': case 'P': case 'q': case 'Q': case 'r': case 'R': case 's': case 'S': case 't': case 'T': case 'v': case 'V': case 'w': case 'W': case 'x': case 'X': case 'y': case 'Y': case 'z': case 'Z': nconsonants++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': ndigits++; break; case '.': case ',': case '!': case '"': case ':': case ';': case '(': case ')': npunctuation++; break; case ' ': nblank++; break; default: nthrerest++; } // switch loop } // for loop printf(" %4d digits \n",ndigits); printf(" %4d vowels \n",nvowels); printf(" %4d consonants \n",nconsonants); printf(" %4d punctuation \n",npunctuation); printf(" %4d blanks \n",nblank); printf(" %4d the rest \n",nthrerest); return(0); }