Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Help please correct the program!

0 votes
asked Apr 14, 2018 by Олександр Ломако (230 points)
edited Apr 16, 2018 by Олександр Ломако
You must enter the lines S and S0. Remove from S string all substrings that coincide with S0. If there are no matching substrings, then print line S without change.

#include <stdio.h>

#include <conio.h>

#include <iostream>

#include <ctype.h>

#include <string.h>

#include <stdlib.h>

#define SIZE 200

main(){

char s[SIZE];

char s0[SIZE];

char *t;

printf("Enter a line:\n");

gets(s);

printf("Enter the search condition:\n");

gets(s0);

while(true){

t=strstr(s,s0);

printf("Matches not found:\n");

if(t!=NULL){

char *t1=t+strlen(s0);

strcpy(t,t1);

printf("Match is deleted:\n");

}else {

printf("The end result:\n");

}

break;

}

puts(s);

getch();

return 0;

}

I do not know how to implement the removal of a few match. I need help!!!

1 Answer

+1 vote
answered Apr 17, 2018 by AQUA Play (500 points)
selected Apr 22, 2018 by Олександр Ломако
 
Best answer
mmmmmm all is ok

try this site  https://www.onlinegdb.com/online_c++_compiler
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...