+ 1
Jungle help
I know i need to get a sttring as out put, but how. I dont think the lessons went over this #include <iostream> using namespace std; string Grr; int main() { string animal; while (cin>>animal) if (animal== Grr){ cout<<animal;} return 0; }
5 odpowiedzi
0
ex:
string animal_sound;
cin >> animal_sound;
if( animal_sound == "Grr" )
cout << "Lion";
0
So theres no point in doing while loop?
0
No. It's just a sample for taking single input.
There task has 3 or 4 inputs by space separated. So you need a loop. Work similarly for other 3 animal sounds.
0
Got it so just if else should work
0
You can try your easy way.. is that works for multiple inputs?
Try it , if it don't work you can come back with your try.. Hope it helps..