Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int length (char *s) {
- int d=0;
- while (*(s++)!='\0') d++;
- return d;
- }
- void cut(char *string, int indeks, int len)
- {
- int i;
- for(i = indeks; i <= length(string) - len; i++)
- {
- string[i] = string[i + len];
- }
- }
- int JeLiBroj (char c) {
- if (c>='0' && c<='9') return 1;
- return 0;
- }
- int JeLiSlovo (char c) {
- if (tolower(c)>='a' && tolower(c)<='z') return 1;
- return 0;
- }
- void Izbaci (char *s, int n) {
- int i, duzina=length(s),poc,kraj;
- char *p=s;
- for (i=0; i<duzina; i++) {
- if (JeLiSlovo(s[i]) && (s[i-1]==' ' || s==p)) {
- poc=i;
- i++;
- while (JeLiSlovo(s[i])) i++;
- kraj=i;
- if ((kraj-poc)==n) {
- cut (s, poc, kraj-poc);
- i-=(kraj-poc);
- }
- }
- }
- }
- int main () {
- char s[]="Selma je bila ovdje jucer.";
- Izbaci(s,5);
- printf("%s", s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement