Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- int main()
- {
- FILE *p;
- p=fopen("text.txt" , "r");
- if(p==NULL){
- printf("Datotekata nemoze da se otvori\n");
- return 0;
- }
- char niza[101];
- int brojac = 0;
- while(fscanf(p, "%s", niza) != EOF) {
- brojac++;
- if(brojac % 3 == 0){
- int dolzina=strlen(niza);
- for(int i=0;i<dolzina;++i){
- niza[i] = tolower(niza[i]);
- if(niza[i] == 'a') {
- if(i == 0) {
- niza[i] =toupper(niza[i]);
- }
- else {
- /// smeni gi vrednostite na niza[i] i niza[i - 1]
- char pom = niza[i];
- niza[i] = niza[i - 1];
- niza[i - 1] = pom;
- }
- }
- }
- printf("%s\n", niza);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement