Advertisement
sellmmaahh

OR-20013-Zad3

Aug 14th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3.  
  4. void Izbaci(char *s, int n) {
  5.     char *p=s;
  6.     while (*p!='\0') p++;
  7.     int broj=0;
  8.  
  9. while (*s!='\0') {
  10.         if (*s>='0' && *s<='9') {
  11.                 char *poc=s;
  12.             broj=broj*10+(*s-'0');
  13.             s++;
  14.         while (*s>='0' && *s<='9') {
  15.                 broj=broj*10+(*s-'0');
  16.         s++;
  17.         }
  18.         char *kraj=s;
  19.         poc--;
  20.         if (broj>n) {
  21.                 while (*kraj!='\0') {
  22.                         *poc++=*kraj++;
  23.                 } *(p-(kraj-poc))='\0';
  24.         }
  25.         else broj=0;
  26.         }
  27.         else s++;
  28. }
  29. }
  30.  
  31.  
  32.     int main () {
  33.     char s[]="U gradovima 8 i 9 temperatura je bila 23 stepena.";
  34.     Izbaci(s, 10);
  35.     printf("%s",s);
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement