Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- char* funkcija (char rijec[], int k)
- {
- char*s =rijec;
- char nova[70];
- char *p=nova;
- int broj;
- int minus=0;
- while(*s != '\0')
- {
- while(*s!='\0' && *s!=' ')
- {
- if (*(s-1)=='-' && *s>='0'&&*s<='9') minus=1;
- if(*s>='0'&&*s<='9')
- {
- broj=0;
- while (*s!='\0' && *s>='0'&&*s<='9')
- {
- broj*=10;
- broj+=(int) (*s- '0');
- *p++=*s++;
- }
- if(minus==1) broj*=-1;
- if(broj>k)
- {
- *p++=' ';
- *p++='j';
- *p++='e';
- *p++='s';
- *p++='t';
- *p++='e';
- *p=' ';
- }
- else
- {
- *p++=' ';
- *p++='n';
- *p++='i';
- *p++='j';
- *p++='e';
- *p=' ';
- }
- minus=0;
- }
- *p++=*s++;
- }
- *p++=*s++;
- }
- *p='\0';
- strcpy(rijec, nova);
- return rijec;
- }
- int main()
- {
- char recenica[100] = "prije125 nov258 brojk-566 -kl879 26999";
- char nova[100];
- char*p =nova;
- p=funkcija(recenica,150);
- while(*p!='\0')
- {
- printf("%c", *p++);
- }
- printf(" veci od %d", 150);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement