// boxFunctions.cpp
// Illustration of nested for loops inside functions
// P. Conrad, CISC181, Spring 2006


#include <iostream>
using std::cout;
using std::cerr;
using std::endl;

// print a box of stars with a certain width and height

void boxOfStars(int width, int height)
{
  for (int i=0; i<height; i++)
    {
      for (int j=0; j<width; j++)
	cout << "*";
      cout << endl;      
    }
  return;
}

// print a box of any character c with a certain width and height

void boxOfChars(int width, int height, char c)
{
  for (int i=0; i<height; i++)
    {
      for (int j=0; j<width; j++)
	cout << c;
      cout << endl;      
    }
  return;
}


int main(void)
{
  cout << "\n"
       << "The first box is 3 high, 4 wide\n"
       << "\n";
  boxOfStars(4, 3); // order of parameters is width, height
  
  cout << "\n"
       << "The next box is 4 high, 3 wide\n"
       << "\n";
  boxOfStars(3, 4); // order of parameters is width, height

  
  cout << "\n"
       << "Another box 4 high, 3 wide, this time with x instead of *\n"
       << "\n";

  boxOfChars(3, 4, 'x'); // order of parameters is width, height, char


  return 0;
}
