Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- char * izbacivanje(char *s, char broj)
- {
- char novi[1000];
- char* p=novi;
- while(*s!='\0')
- {
- if(*s!=(char)(broj+48))
- {
- *p++=*s;
- }
- s++;
- }
- return novi;
- }
- char* funkcija(char s[], int k)
- {
- char* pok=s;
- int i=0,br,cifra;
- while(s[i]!='\0')
- {
- if(s[i]=='0'||s[i]=='1'||s[i]=='2'||s[i]=='3'||s[i]=='4'||s[i]=='5'||s[i]=='6'||s[i]=='7'||s[i]=='8'||s[i]=='9')
- {
- br=0;
- while(s[i]=='0'||s[i]=='1'||s[i]=='2'||s[i]=='3'||s[i]=='4'||s[i]=='5'||s[i]=='6'||s[i]=='7'||s[i]=='8'||s[i]=='9')
- {
- br*=10;
- br+=(s[i]-48);
- i++;
- }
- if(br>k)
- {
- while(br!=0)
- {
- cifra=br%10;
- pok=izbacivanje(pok, (char)cifra);
- br/=10;
- }
- }
- }
- i++
- }
- return pok;
- }
- int main()
- {
- char rijec[15]= {"Neki broj 5"};
- char nova[15];
- char* p=nova;
- p=funkcija(rijec,4);
- while(*p!='\0')
- {
- printf("%c", *p++);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement