Advertisement
Josif_tepe

Untitled

Jun 12th, 2021
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <string.h>
  4. #include <math.h>
  5.  
  6.  
  7. int main() {
  8.     FILE *vlez = fopen("podatoci.txt", "r");
  9.     char z1, z2;
  10.     scanf("%c%c", &z1, &z2);
  11.     char niza[100];
  12.     while(fgets(niza, 80, vlez)) {
  13.         if(niza[0] == '#') {
  14.             break;
  15.         }
  16.         int S, E;
  17.         for(int i = 0; i < strlen(niza); i++) {
  18.             if(niza[i] == z1) {
  19.                 S = i;
  20.             }
  21.             if(niza[i] == z2) {
  22.                 E = i;
  23.             }
  24.         }
  25.         for(int i = S + 1; i < E; i++) {
  26.             printf("%c", niza[i]);
  27.         }
  28.         printf("\n");
  29.     }
  30.     return 0;
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement