+ 2

how to set all the spaces in a string to @ or any other character

13th Apr 2017, 2:46 PM
AISHWARY SINGH CHAUHAN
AISHWARY SINGH CHAUHAN - avatar
2 Answers
+ 4
Set all the spaces in a string to @, visit: https://code.sololearn.com/cj9oWmRA82Jj/?ref=app
13th Apr 2017, 3:35 PM
à€Šà„‡à€”à„‡à€‚à€Šà„à€° à€źà€čà€Ÿà€œà€š (Devender)
à€Šà„‡à€”à„‡à€‚à€Šà„à€° à€źà€čà€Ÿà€œà€š (Devender) - avatar
+ 4
create a for loop. Example below. #include <iostream> #include <string> using namespace std; int main() { string password = "helloworld"; for(unsigned int i = 0; i < password.length(); i++) { password[i] = '@'; } return 0; }
13th Apr 2017, 5:29 PM
Joshua Pierson
Joshua Pierson - avatar