Advertisement
IlijaTrnkovski

soglaski / samoglaski datoteka

Jan 16th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. FILE *vleznadat;
  5. FILE *izleznadat;
  6. char c;
  7. int samoglaski=0, soglaski=0;
  8. vleznadat=fopen("C:\\Users\\trnko\\Desktop\\matrici - auditoriski\\datotekiii\\input.txt","r");
  9. if(vleznadat==NULL)
  10. {
  11. printf("Input.txt ne mozhe da se otvori!\n");
  12. return -1;
  13. }
  14. izleznadat=fopen("C:\\Users\\trnko\\Desktop\\matrici - auditoriski\\datotekiii\\output.txt","w");
  15. if(izleznadat==NULL){
  16. printf("Output.txt ne mozhe da se otvori!\n");
  17. return -1;
  18. }
  19.  
  20. while((c=fgetc(vleznadat))!= EOF)
  21. {
  22. if((c>= 'a'&&c<='z')||(c>='A'&&c<='Z'))
  23. {
  24. c=tolower (c);
  25.  
  26. if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
  27. {
  28. samoglaski++;
  29. }
  30. else
  31. {
  32. soglaski++;
  33. }
  34. }
  35. }
  36. fclose(vleznadat);
  37.  
  38. fprintf(izleznadat, "Samoglaski: %d, Soglaski: %d ", samoglaski, soglaski);
  39. fclose(izleznadat);
  40.  
  41.  
  42.  
  43.  
  44.  
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement