-
1 Beiträge
-
0 Fotos
-
0 Videos
-
Male
-
10/09/1992
-
Follower 1 Menschen
-
Account Type
Personal
Neueste Updates
-
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main() {
// Liste von Wörtern die du verbieten willst
const char* blocked_words[] = {"wort1", "wort2", "test"};
int num_words = 3;
char input[500];
printf("Gib Text ein: ");
fgets(input, 500, stdin);
// Geht alle verbotenen Wörter durch
for(int i = 0; i < num_words; i++) {
char* pos = strstr(input, blocked_words[i]);
while(pos!= NULL) {
// Ersetzt das Wort durch ***
for(int j = 0; j < strlen(blocked_words[i]); j++) {
pos[j] = '*';
}
pos = strstr(pos + 1, blocked_words[i]);
}
}
printf("Gefilterter Text: %s", input);
return 0;
}#include <stdio.h> #include <string.h> #include <ctype.h> int main() { // Liste von Wörtern die du verbieten willst const char* blocked_words[] = {"wort1", "wort2", "test"}; int num_words = 3; char input[500]; printf("Gib Text ein: "); fgets(input, 500, stdin); // Geht alle verbotenen Wörter durch for(int i = 0; i < num_words; i++) { char* pos = strstr(input, blocked_words[i]); while(pos!= NULL) { // Ersetzt das Wort durch *** for(int j = 0; j < strlen(blocked_words[i]); j++) { pos[j] = '*'; } pos = strstr(pos + 1, blocked_words[i]); } } printf("Gefilterter Text: %s", input); return 0; }0 Kommentare 0 Geteilt 123 AnsichtenBitte loggen Sie sich ein, um liken, teilen und zu kommentieren!
Mehr Storys