+ 1

I need help for this code!!

Sorry I have a problem again on the same code. The code allows you to encrypt a single word. Wanting to solve this problem I tried to create by reusing the same algorithm, modifying the variables, to make it work, but after the first "while", the script stops working. https://code.sololearn.com/c355D4Hox52H Thinking it was a problem related to the second "while" loop, I tried to write a simple "cout <<" a"" after the first one, but it doesn't appear the same, am I doing something wrong?

15th Jun 2020, 5:06 PM
Biondi Tommaso
Biondi Tommaso - avatar
3 Answers
+ 3
https://code.sololearn.com/cR2FwB5cMFgX/?ref=app I reworked the code and I would like to point a few things. 1. Proper Indentation is a good practice. 2. You can't really handle strings like that, it is really error prone. 3. Iteration on string is much better than using intermediate replacement. What was happening was an infinite loop because the while condition was always true. So, the program just stuck there.
15th Jun 2020, 7:29 PM
Anubhav Mattoo
Anubhav Mattoo - avatar
+ 1
Well, just to be sure, try your code on some other online compiler and then try to replicate the issue.
15th Jun 2020, 6:40 PM
Anubhav Mattoo
Anubhav Mattoo - avatar
+ 1
i had alredy tryed it, but it doesn`t work
15th Jun 2020, 6:50 PM
Biondi Tommaso
Biondi Tommaso - avatar