Displaying ./code/sternflCode/the.c#include<stdio.h>
int main() {
//program to connect to the file
FILE *f = fopen("/u1/junk/shakespeare.txt", "r");
int c; //current char
int p;
int v;
int w;
int x;
// t h e
// v p c
int count=0;
while ( (c=fgetc(f)) != EOF) {
if (x==' ' && w=='T' && v=='h' && p=='e' && c==' ')
count++;
x = w;
w=v;
v=p;
p=c;
}
printf("%d\n", count);
return 0;
}
|