Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- int main() {
- char s[] ="Din departare se vede tare";
- char c[] = "tare";
- char *pch = strstr(s, c); // tare se vede tare
- if(pch != NULL) {
- while(pch != NULL) {
- for(int i = 0; i < strlen(c);i++) {
- *(pch+i) = '*'; // pch este o pozitie => un pointer la pozitia
- }
- pch = strstr(pch, c);
- }
- cout << s << endl;
- } else {
- cout << "IMPOSIBIL";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement