// boxOfStars.cpp
// Illustration of simple nested for loops
// P. Conrad, CISC181, Spring 2006


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


int main(void)
{
  cout << "This program demonstrates some simple nested loops\n" 
       << "by printing boxes\n"
       << "\n"
       << "The first box is 3 high, 4 wide\n"
       << "\n";

  for (int i=0; i<3; i++)
    {
      for (int j=0; j<4; j++)
	cout << "*";
      cout << endl;      
    }
  
  cout << "\n"
       << "The next box is 4 high, 3 wide\n"
       << "\n";

  for (int i=0; i<4; i++)
    {
      for (int j=0; j<3; j++)
	cout << "*";
      cout << endl;      
    }
  
  cout << "\n"
       << "Another box 4 high, 3 wide, but composed with a different loop\n"
       << "\n";

  for (int i=1; i<=4; i++)
    {
      for (int j=1; j<=3; j++)
	cout << "*";
      cout << endl;      
    }

  cout << "\n"
       << "Now a 7x7 box of alternating x's and o's\n" 
       << "\n";

  for (int i=0; i<7; i++)
    {
      for (int j=0; j<7; j++)
	cout << ( ((i+j)%2==0 ) ? "x" : "o" );
      cout << endl;      
    }


  return 0;
}




