0
Jungle camping question
Can anyone help me to find the mistake of this code related to the jungle camping question in code coach? #include <iostream> #include <string.h> using namespace std; int main() { int i,name,j; cin>>name; string a,b,c,d,sounds[name]; a="Grr"; b="Rawr"; c="Ssss"; d="Chirp"; for(j=0;j<name;j++){ cin>>sounds[j]; cout<<sounds[j]; } for(i=0;i<4;i++) { if (sounds[i]==a) cout<<"Lion"<<" "; if (sounds[i]==b) cout<<"Tiger"<<" "; if (sounds[i]==c) cout<<"Snake"<<" "; if (sounds[i]==d) cout<<"Bird"<<" "; } return 0; }
2 Respostas
+ 3
The input Instructions clearly specify that that input will be sounds of animals, along with an example.
They will not provide you with the number of sounds which are there in input.
+ 1
The task is : the input should be a string not an int and after each animal in output u should add a space
I tried to understand ur code but i don't use c++