#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <iostream.h>
int main(void)
{
char x;
FILE *wordcount;
int count = 0;
wordcount = fopen("gettys.txt", "r+");
if (wordcount == NULL)
printf("\nFile gettys.txt cannot be opened.\n");
while ( !feof(wordcount) )
{
fscanf(wordcount, "%c", &x);
for (count = 0; isspace(x); count++)
{
count = count +1;
}
}
return count;
printf("\nThe Gettysburg Address contains %d words.\n", &count);
fclose(wordcount);
}
Attached File(s)
-
gettys.txt (1.45K)
Number of downloads: 261

New Topic/Question
Reply




MultiQuote




|