Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

Experiment 59

#include<stdio.h>
int main()
{
FILE *fs,*ft;
int c=0,w=1,s=0;
char ch;
clrscr();
fs=fopen("a.txt","r");
ft=fopen("b.txt","w");
while(!feof(fs))
{
ch=fgetc(fs);
if(ch>64&&ch<92||ch>97&&ch<123)
c++;
else if(ch==32||ch>46&&ch<57)
w++;
else if(ch==46||ch==44||ch==63)
s++;

}
fprintf(ft,"The File a.txt contains %d Characters\nIt contains %d words.And %d
Sentences",c,w,s);
fcloseall();

getch();
return 0;
}

You might also like