Thread: Filing Help In C Language View Single Post
 Newbie Member 27Nov2010,18:50 // A program to read a file and check how many vowels, spaces and consonents are there in a file My Questions: // A program to read a file and check how many words are there in a file // A program to read a file and check how many characters are there in a file can anyone solve these questions using below program.Please help me i am new in this form. Code: # include # include # include void main () { clrscr(); char ch; FILE *fptr; int a = 0,e = 0,i = 0,o = 0,u = 0,c = 0,s=0,sum ; if ((fptr = fopen("jawwad.txt","r"))== NULL) { printf("Can't open the file"); getch(); exit(1);} while ((ch =getc(fptr))!= EOF){ printf("%c",ch); switch(ch) { case 'a': a++; break; case 'e': e++; break; case 'i': i++; break; case 'o': o++; break; case 'u': u++; break; case '': s++;break; default: c++; } } printf(" \na=%d, \ne=%d, \ni=%d, \no=%d, \nu=%d, \ns=%d, \nc=%d",a,e,i,o,u,s,c); { sum=a+e+i+o+u+s+c; printf("\nThe sum is %d",sum); } fclose(fptr); getch(); } My Questions: // A program to read a file and check how many words are there in a file // A program to read a file and check how many characters are there in a file can anyone solve these questions using above program Last edited by shabbir; 27Nov2010 at 19:19.. Reason: Code blocks