Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void unos (char *s) {
- char c;
- int i=0;
- do {
- c=getchar();
- s[i]=c;
- i++;
- }
- while (c!='\n' && i<100);
- s[i-1]='\0';
- }
- int length (char *s)
- {
- int duzina=0;
- while (*(s++)!='\0') duzina++;
- return duzina;
- }
- void cut(char *string, int indeks, int len)
- {
- int i;
- for(i = indeks; i <= length(string) - len; i++)
- {
- string[i] = string[i + len];
- }
- }
- int JeLiCifra (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 IzbaciRijec (char *s) {
- int i, duzina=length(s), poc, kraj;
- for (i=0; i<duzina; i++) {
- if (JeLiCifra(s[i])) {
- poc=i;
- i++;
- while (JeLiSlovo(s[i])) i++;
- kraj=i;
- cut(s,poc,kraj-poc);
- i-=(kraj-poc);
- }
- }
- }
- int main () {
- char s[100]="Trebam 3da 4izbacim 4rijec selma";
- IzbaciRijec(s);
- printf("%s", s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement