Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <string.h>
  4. #define MAX 80
  5.  
  6. void wtf() {
  7. FILE *f = fopen("text.txt", "w");
  8. char c;
  9. while((c = getchar()) != EOF) {
  10. fputc(c, f);
  11. }
  12. fclose(f);
  13. }
  14. char Samoglaska(char c)
  15. {
  16. toupper(c); //site golemi da gi naprai
  17. if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u') {
  18. return 1;
  19. }
  20. }
  21.  
  22.  
  23. int main() {
  24. wtf();
  25. FILE* f=fopen("text.txt", "r");
  26. if(f==NULL) {
  27. return 0;
  28. }
  29. char red[MAX],posledovatelni[MAX];
  30. int i,n,reden,max=0,brojac=0, maxRed=0;
  31. while(fgets(red,MAX,f)!=NULL)
  32. {
  33. n=strlen(red);
  34. for(i=0;i<n;i++)
  35. {
  36.  
  37. if(!Samoglaska(red[i]) && !isspace(red[i])
  38. {
  39. brojac++;
  40. }
  41.  
  42. else if(Samoglaska(red[i])
  43. {
  44. if(brojac>=max)
  45. {
  46. max=brojac;
  47. brojac=0;
  48. }
  49. }
  50.  
  51.  
  52. }
  53. if(max>maxRed)
  54. {
  55. maxRed=max;
  56. for(i=0;i<80;i++)
  57. {
  58. posledovatelni[i]=red[i];
  59. }
  60. }
  61.  
  62. printf("%d\n",maxRed);
  63. printf("%s",posledovatelni);
  64. fclose(f);
  65. return 0;
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement