Created
June 1, 2010 19:58
-
-
Save rpt/421393 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int strfindandblank( char *source, char *find ) { | |
int ile = 0, dalej = 1; | |
char *pch; | |
while (dalej!=0) { | |
pch = strstr (source, find); | |
if (pch!=NULL) { | |
memset (source,' ', atoi(pch)); | |
ile+=strlen(find); | |
} | |
else dalej=0; | |
} | |
return ile; | |
} | |
int main() { | |
char source[200], find[100]; | |
printf("Podaj ciag znakow:\n"); | |
fgets(source, 200, stdin); | |
printf("Podaj szukana fraze:\n"); | |
fgets(find, 100, stdin); | |
printf("Zamieniono na spacje %i znakow.\n", strfindandblank(source, find)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment