// A program to make the lyric sheet for old MacDonald. #include #include const char tab = '\t'; const string LINE1 = "Old MacDonald Had A Farm"; const string LINE2 = "E-I-E-I-O"; const string LINE3a ="And On His Farm He Had A "; const string LINE5a ="With a "; const string LINE5b = " here and a "; const string LINE5c = " there"; const string LINE6a ="Here a "; const string LINE6b = " there a "; const string LINE6c = " everywhere a "; int main () { string animal; // the animal that we have string sound; // the sound that that animal makes string line3, // The third line of the song line5, // The fifth line of the song line6; // The sixth line of the song // Get the values for the anamal and the sound. animal = "Duck"; sound = "Quack"; // Consturct the third line // We need to add the animal name to the end. line3 = LINE3a + animal; // Construct the fifth line, We need the sound, plus spaces // between the sound. line5 = LINE5a + sound + " " + sound + LINE5b + sound + " " + sound + LINE5c; // Construct the sixth line. Much like the fifth. line6 = LINE6a + sound + LINE6b + sound + LINE6c + sound + " " + sound; // Output the song. cout << endl << endl; cout << tab << LINE1 << endl; cout << tab << LINE2 << endl; cout << tab << line3 << endl; cout << tab << LINE2 << endl; cout << tab << line5 << endl; cout << tab << line6 << endl; cout << tab << LINE1 << endl; cout << tab << LINE2 << endl; cout << endl << endl; // exit the program. return(0); }