+ 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?
3 odpowiedzi
+ 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.
+ 1
use that, would help u——
https://code.sololearn.com/cIZ89f669Q6t/?ref=app
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;
}
}