#include <iostream> // <===== you will need this for input/output
#include <string> // <===== you would be better having this if using strings
usingnamespace std; // <===== EITHER: put this here,
// OR: qualify everything that needs it (e.g. std::cout)
void Verse( string animal, string noise )
{
cout << "Old McDonald had a farm, "
<< "Ei-igh, Ee-igh, oh!" << endl;
cout << "And on his farm he had a " << animal << "," << endl;
cout << "With a " << noise << " " << noise << " here " << endl
<< "And a " << noise << " " << noise << " there " << endl;
cout << "Here a " << noise << ", " << endl
<< "There a " << noise << ", " << endl
<< "Everywhere a " << noise << " " << noise << endl;
cout << "Old McDonald had a farm, " // The version I remember ended like this
<< "Ei-igh, Ee-igh, oh!" << endl;
}
int main()
{
string animal;
string noise;
cout << "Enter the name of an animal: " ;
cin >> animal;
cout << "Enter noise that a " << animal << " makes: " ;
cin >> noise;
Verse( animal, noise );
// return 0; // not actually needed in main()
}
Enter the name of an animal: cow
Enter noise that a cow makes: moo
Old McDonald had a farm, Ei-igh, Ee-igh, oh!
And on his farm he had a cow,
With a moo moo here
And a moo moo there
Here a moo,
There a moo,
Everywhere a moo moo
Old McDonald had a farm, Ei-igh, Ee-igh, oh!