Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- #include <stdlib.h>
- int main()
- {
- FILE *f;
- char filename[256];
- int c; int chars = 0; int lines = 0; int letters = 0; int digits = 0; int uppers = 0; int lowers = 0 ; int spaces = 0; int puncts = 0;
- printf("Введите имя файла \n");
- scanf("%s", filename);
- f=fopen(filename,"r");
- if (!f)
- {
- printf("Файл не найден \n");
- return 0;
- }
- while((c=fgetc(f)) !=EOF)
- {
- chars++;
- if(c == '\n') lines++;
- if(isalpha(c)) letters++;
- if(isdigit(c)) digits++;
- if(isspace(c)) spaces++;
- if(isupper(c))uppers++;
- if(islower(c)) lowers++;
- if(ispunct(c)) puncts++;
- }
- printf("%d", letters);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement