Cpp program to replace string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Cpp program to replace string

Write a cpp program using class with function replace(char*str, char c1,char c2) every occurrence of c1 in str should be replaced with c2 and return number of replacement it makes

18th Jan 2018, 5:09 PM
swapnil wakchaure
swapnil wakchaure - avatar
4 Answers
+ 5
Sounds for me like homework...
18th Jan 2018, 6:12 PM
I. Stark
I. Stark - avatar
+ 1
https://code.sololearn.com/cLWDxI2yYWwD/#cpp //You could have done this yourself, though.
19th Jan 2018, 11:01 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
0
Can you tell me why you need a class for this, when all you have to do is manipulate a c-string?
19th Jan 2018, 4:34 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
0
ok then give that code
19th Jan 2018, 7:25 AM
swapnil wakchaure
swapnil wakchaure - avatar