0

Write a program to input a string and replace all the occurrences of character T with @

23rd Jan 2018, 2:08 PM
VEDANG BADHWAR
VEDANG BADHWAR - avatar
3 Respostas
+ 5
Just do : replace(str.begin(), str.end(), 'T', '@'); // Basically does the same thing // as a for loop used to replace // each character.
23rd Jan 2018, 3:00 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
23rd Jan 2018, 2:14 PM
shobhit
shobhit - avatar
0
To see how it works: for (char &c : str) if (c == 'T') c = '&';
23rd Jan 2018, 8:50 PM
Timon Paßlick