/*
 * Prints numbers from 1 to 10, inclusive, without using control structures or
 * short circuit operators. It uses function pointers instead.
 *
 * Author: Jacob Taylor
 */

#include <iostream>
using namespace std;

//print numbers from 1 to LIMIT
const int LIMIT = 10;

void baseCase(int recurseFrom) {
}

void printNumsFrom(int lower) {
  cout << lower << ' ';
  //set up an array of function pointers
  void (*cases[2])(int);
  cases[0] = baseCase;
  cases[1] = printNumsFrom;
  //the right function is called based on the index lower < LIMIT
  cases[lower < LIMIT](lower + 1);
}

int main() {
  printNumsFrom(1);
  cout << endl;
  return 0;
}
