SOURCE FILE: ex0102.cpp
// Example 1.2. Program to display "This Old Man"
#include <iostream.h>
void chorus(void);
void FirstVerse(void);
void SecondVerse(void);
void ThirdVerse(void);
int main(void)
{
FirstVerse();
chorus();
SecondVerse();
chorus();
ThirdVerse();
chorus();
return 0;
}
// Function to print the chorus
void chorus(void)
{
cout << " With a knick-knack-paddy-whack\n";
cout << " Give the dog a bone,\n";
cout << " This old man went rolling home.\n\n";
}
// Function to print the first verse
void FirstVerse(void)
{
cout << "This old man, he played one,\n";
cout << "He played knick-knack on my thumb,\n";
}
// Function to print the second verse
void SecondVerse(void)
{
cout << "This old man, he played two,\n";
cout << "He played knick-knack on my shoe,\n";
}
// Function to print the third verse
void ThirdVerse(void)
{
cout << "This old man, he played three,\n";
cout << "He played knick-knack on my knee,\n";
}