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()
- {
- char a1, a2;
- scanf("%c %c", &a1, &a2); // vo scanf mora da ima prazno mesto megu 2 karakteri
- FILE *p = fopen("in.txt", "r");
- char niza[85];
- while(fgets(niza, 80, p) != NULL) { // dur ne stigneme do krajot od fajlot
- int n = strlen(niza); // dolzina na nizata
- int a1_indeks;
- int a2_indeks;
- for(int i = 0; i < n; i++) {
- if(niza[i] == a1) {
- a1_indeks = i;
- }
- if(niza[i] == a2) {
- a2_indeks = i;
- }
- }
- for(int i = a1_indeks + 1; i <= a2_indeks - 1; i++) {
- printf("%c", niza[i]);
- }
- printf("\n");
- }
- return 0;
- }
- // o|abbbbaaaazaab|i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement