/*****************************************************************/
/*                                                               */
/*                   Print Box Program                           */
/*                                                               */
/*****************************************************************/
/*                                                               */
/*                  Programmer:  Jim Shew                        */
/*                                                               */
/*****************************************************************/
/*                                                               */
/*  This program accepts two numbers from the user.  If the two  */
/*  numbers are odd, the program will print out a solid box of   */
/*  the given size.  If the two number are even then a hole of   */
/*  the given size will be placed inside a 10x10 box.            */
/*                                                               */
/*****************************************************************/
/*                                                               */
/*                     Variables                                 */
/*        int  wide  width of box or hole                        */
/*        int  high  height of box or hole                       */
/*        int  i, j  indicies for loops                          */
/*                                                               */
/*****************************************************************/
#include <stdio.h>
void main(void)
{
	int wide; /* width of box or hole  */
	int high; /* height of box or hole */
	int i, j; /* loop indicies         */
	
	printf("Please input the width of the box ");
	scanf("%i", &wide);
	printf("Please input the box height ");
	scanf("%i", &high);
/*****************************************************************/
/*  Check for input out of bounds                                */
/*****************************************************************/
	if ( wide < 0 || wide > 10 || high < 0 || high > 10 )
	{
		printf("*** Error *** Input must be greater than zero\n");
		printf("              and less than ten\n");
	}/* end size error */
/*****************************************************************/
/*  Check for input out of bounds                                */
/*****************************************************************/
	else
	{
		if (wide%2 == 0 && high%2 == 0 )
/*****************************************************************/
/*  Both numbers even print box with hole in it                  */
/*****************************************************************/
		{
			for(i = 1; i <= (10-high)/2; i++) /* top lines       */
				printf("**********\n");
			for(j = 1; j <= high; j++)        /* height of hole  */
			{
				for (i = 1; i <= (10-wide)/2; i++) /* left       */
					printf("*");
				for (i = 1; i <= wide; i++)        /* hole       */
					printf(" ");
				for (i = 1; i <= (10-wide)/2; i++) /* right      */
					printf("*");
				printf("\n");
			} /* end hole */
			for (i = 1; i <= (10-high)/2; i++) /* bottom lines   */
				printf("**********\n");
		} /* end box with hole */
/*****************************************************************/
/*  Both number are odd print box of that size                   */
/*****************************************************************/
		
		else if (wide%2 != 0 && high%2 != 0)
		{
			for(j = 1; j <= high; j++)
			{
				for(i = 1; i <= wide; i++)
					printf("*");
				printf("\n");
			}/* end box */
			
		}/* end if for box */
/*****************************************************************/
/*  Numbers are not both even or odd                             */
/*****************************************************************/
		else
		{
			printf("*** Error *** both numbers must be either be\n");
			printf("              odd or even.  You cannot mix \n");
			printf("              odd and even.\n");
		} /* end error else */
	} /* end else for execution */
} /* end main */

