C++ examples for Function:Recursive Function
Recursion function is a function to call itself
#include <iostream> 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/*w ww .j a va 2 s. c o m*/ cout << "Done" << endl; } int main() { removeHat('A'); }