/* Programmer: Greg Perkins Program: ltr_count1.c Class: CS 73 C/UNIX Due: 17 February 1998 This program does the exact same thing that letter_count.c did. The only difference is that the program has been separated into two files for a multi-file compiler exercise. */ #include #include int main() { int count = 0; int new_char, prev_char = -999; /* -999 indicates first character */ while ((new_char = getchar()) != EOF) { /* consider upper & lowercase letters as equal */ if (isalpha(new_char)) new_char = tolower(new_char); if (prev_char != -999) /* if past first character */ { /* if new_char is not whitespace or punctuation check repeat */ if(isalnum(new_char)) if (are_equal(new_char, prev_char)) count++; else prev_char = new_char; } else prev_char = new_char; } printf("\nThe number of repeated characters was %d.\n", count); return (0); }