// Drew Duffey CSC5 Chapter 5, P.298, #22
//
/*******************************************************************************
*
* CREATE RECTANGLE
* _____________________________________________________________________________
* This program will generate a rectangle with specific dimensions, using the
* character 'X'.
* _____________________________________________________________________________
* INPUT
* Square X : How many columns the rectangle should be
* Square Y : How many rows the rectangle should be
*
* OUTPUT
* The output for this program is the rectangle drawn given the dimensions.
*
*******************************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
int count;//CALC - Counter for loops
int count2;//CALC - Counter for loops
int sqX;//INPUT - How many columns the rectangle should be
int sqY;//INPUT - How many rows the rectangle should be
//Prompt input for dimensions
cout << "Input the X and Y dimensions of a rectangle. "
<< "They should be no more than 15, and a space should seperate them."
<< endl;
cin >> sqX >> sqY;
//Check to see if inputs are valid
if (sqX > 15 || sqY > 15 || sqX < 1 || sqY < 1)
{
cout << "\nINVALID INPUT. TRY AGAIN.";
return 0;
}
//Draw rectangle
cout << endl;
for (count = 1; count <= sqY; count++)
{
for (count2 = 1; count2 <= sqX; count2++)
{
cout << "X";
}
cout << endl;
}
return 0;
}