//: C03:CatsInHats.cpp // From Thinking in C++, 2nd Edition // Available at http://www.BruceEckel.com // (c) Bruce Eckel 2000 // Copyright notice in Copyright.txt // Simple demonstration of recursion #include using namespace std; void removeHat(char cat) { for(char c = 'A'; c < cat; c++) cout << " "; if(cat <= 'Z') { cout << "cat " << cat << endl; removeHat(cat + 1); // Recursive call } else cout << "VOOM!!!" << endl; } int main() { removeHat('A'); } ///:~