Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- FILE *vleznadat;
- FILE *izleznadat;
- char c;
- int samoglaski=0, soglaski=0;
- vleznadat=fopen("C:\\Users\\trnko\\Desktop\\matrici - auditoriski\\datotekiii\\input.txt","r");
- if(vleznadat==NULL)
- {
- printf("Input.txt ne mozhe da se otvori!\n");
- return -1;
- }
- izleznadat=fopen("C:\\Users\\trnko\\Desktop\\matrici - auditoriski\\datotekiii\\output.txt","w");
- if(izleznadat==NULL){
- printf("Output.txt ne mozhe da se otvori!\n");
- return -1;
- }
- while((c=fgetc(vleznadat))!= EOF)
- {
- if((c>= 'a'&&c<='z')||(c>='A'&&c<='Z'))
- {
- c=tolower (c);
- if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
- {
- samoglaski++;
- }
- else
- {
- soglaski++;
- }
- }
- }
- fclose(vleznadat);
- fprintf(izleznadat, "Samoglaski: %d, Soglaski: %d ", samoglaski, soglaski);
- fclose(izleznadat);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement