+ 1

Jungle camping question

In the challenge Jungle Camping, the objective is to match the sound to the animal. I kept getting the challenge wrong because the output. For example, lion makes grr. So I wrote th code but I got it worng. You must write lion twice in the code. I don't understand why. Can someone explain why you must write lion twice in the code in order to get the the challenge right?

9th Feb 2020, 7:53 PM
Ricardo Roman
Ricardo Roman - avatar
3 Antworten
+ 4
Look at this sentence from the task: 'A string that includes each animal that you hear with a space after each one. (animals can repeat)' So there might be several times the same animal noise, and your code has to loyally report every animal you hear, as you're hearing them.
9th Feb 2020, 8:13 PM
HonFu
HonFu - avatar
+ 1
20th Oct 2020, 8:47 AM
イデリセ{非活性}
イデリセ{非活性} - avatar
0
How i did my code using c# class Program { static void Main(string[] args) { String sounds; sounds=Console.ReadLine(); String[] getsound=sounds.Split(" "); foreach (string soundarr in getsound){ switch (soundarr){ case "Grr": Console.Write("Lion "); break; case "Rawr": Console.Write("Tiger "); break; case "Ssss": Console.Write("Snake "); break; case "Chirp": Console.Write("Bird "); break; } }
11th Feb 2020, 1:37 PM
Prisca Goodluck
Prisca Goodluck - avatar