Advertisement
Guest User

Untitled

a guest
Dec 26th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5. #define MAX 100
  6.  
  7.  
  8. //ne menuvaj!
  9. void wtf() {
  10. FILE *f = fopen("text.txt", "w");
  11. char c;
  12. while((c = getchar()) != EOF) {
  13. fputc(c, f);
  14. }
  15. fclose(f);
  16. }
  17.  
  18. int main()
  19. {
  20. wtf();
  21.  
  22. int a,b=0,i=0,j;
  23. char c,d[100];
  24. FILE *input;
  25. if (( input = fopen ("text.txt", "r")) == NULL ) {
  26. printf (" The file cannot be open .\n") ;
  27. return -1;}
  28.  
  29. while((fgets(d,100,input))!=NULL)
  30. {
  31. for(i=0;i<strlen(d);i++)
  32. if(isupper(d[i])&&isspace(d[i-1])) b++;
  33. if(isupper(d[0])) b++;
  34. }
  35. fclose(input);
  36. printf("%d",b);
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement