How can I replace a string of characters with x's | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I replace a string of characters with x's

In my latest code, I am trying to get a string of text to be replace by x's. The problem I am running into is that it is only printing one x. string password; for (counter = 0; counter <= passwordLength; counter++) { cout<<"x"; } Full code below: https://code.sololearn.com/cRKP5pKbTdMI/?ref=app

14th Nov 2019, 7:49 PM
Heather Cook
Heather Cook - avatar
3 Answers
+ 1
Meaning that password it taking is zero length. here you are calculating password length before taking password input. count after taking input. check these ones.. As you are using getline method you need to input with multi lines..
14th Nov 2019, 8:00 PM
Jayakrishna 🇮🇳
0
thank you! that seemed to do the trick!
14th Nov 2019, 8:45 PM
Heather Cook
Heather Cook - avatar
0
Wel come
14th Nov 2019, 8:46 PM
Jayakrishna 🇮🇳