CS 3358 (Data Structures and Algorithms) by Lee S. Koh
Answer 2: How to Overcome/Avoid

#include <iostream>
#include <cstdlib>
using namespace std;

template <class T1, class T2>
void EchoManyTimes(T1 value, T2 numOfTimes);

int main()
{
   const int J = 3;
   const size_t K = 4;

   int    i = 2;
   double d = 3.3;
   char   c = 'a';

   EchoManyTimes(1, 1);
   EchoManyTimes(i, i);
   EchoManyTimes(d, J);
   EchoManyTimes(c, K);

   return EXIT_SUCCESS;
}

template <class T1, class T2>
void EchoManyTimes(T1 value, T2 numOfTimes)
{
   T2 count;

   for (count = 1; count <= numOfTimes; count++)
      cout << value << endl;
}