Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <string.h>
- #define MAX 100
- //ne menuvaj!
- void wtf() {
- FILE *f = fopen("text.txt", "w");
- char c;
- while((c = getchar()) != EOF) {
- fputc(c, f);
- }
- fclose(f);
- }
- int main()
- {
- wtf();
- int a,b=0,i=0,j;
- char c,d[100];
- FILE *input;
- if (( input = fopen ("text.txt", "r")) == NULL ) {
- printf (" The file cannot be open .\n") ;
- return -1;}
- while((fgets(d,100,input))!=NULL)
- {
- for(i=0;i<strlen(d);i++)
- if(isupper(d[i])&&isspace(d[i-1])) b++;
- if(isupper(d[0])) b++;
- }
- fclose(input);
- printf("%d",b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement