Please help my coding!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please help my coding!!

I was doing the jungle camping task in c++ can any one help me. What is the problem with my code? The answer no.5 is failed. I don't know what's wrong because the anwer is lock. I can't see it. https://code.sololearn.com/ccDlwFnmRXbG/?ref=app

23rd Dec 2022, 8:43 AM
Muhammad Rohisyam Bin Rodzy
5 Answers
+ 4
Instead of fixed number of inputs, you can use a while loop and a single string like : while( cin >> noiseArr ){ // loop terminates when there is no input.. you're welcome...
23rd Dec 2022, 9:16 AM
Jayakrishna 🇮🇳
+ 3
Input words are not fixed. You are taking only 4 inputs. But there are 3 or 5 or more inputs...
23rd Dec 2022, 8:54 AM
Jayakrishna 🇮🇳
+ 2
Thank you..!! I just fix it!!! I just add 6 inputs and it's work..!! https://code.sololearn.com/cfLoCgqivQZQ/?ref=app
23rd Dec 2022, 9:07 AM
Muhammad Rohisyam Bin Rodzy
+ 2
You can create words[] from string of input line using my code! https://www.sololearn.com/compiler-playground/cgc4eCpji392/#cpp then pass word[] array to your function noise(word, n) with n as its size
23rd Dec 2022, 1:24 PM
Gaurav Kaushik
+ 1
Oh i see.. i try to code use while loop function and yes! It is easy way to write the code and no need to declare the size of array. I don't understand the different of while loop and for loop before. I still learn it.. Thank you very much sir! https://code.sololearn.com/cM3eWitI7oGK/?ref=app
23rd Dec 2022, 10:15 AM
Muhammad Rohisyam Bin Rodzy