//Dione Torrevillas                 CS1A                 Chapter 5, P. 298, #22
//
/**********************************************************************
 *
 * SQUARE DISPLAY
 *
 * This program asks the user for a positive integer no greater
 * than 15. It then displays a square made of the character X.
 * The number entered determines the length of each side.
 *
 * INPUT
 *   size         : Length of each side of the square
 *
 * OUTPUT
 *   X characters : Square displayed on the screen
 *
 **********************************************************************/

#include <iostream>
using namespace std;

int main()
{
    int size;        //INPUT - Size of the square
    int row;         //CALC  - Row counter
    int column;      //CALC  - Column counter

    //
    // Get User Input
    //
    cout << "Enter a positive integer from 1 through 15: ";
    cin >> size;

    //
    // Validate Input
    //
    while (size < 1 || size > 15)
    {
        cout << "Please enter a number from 1 through 15: ";
        cin >> size;
    }

    //
    // Display Square
    //
    for (row = 1; row <= size; row++)
    {
        for (column = 1; column <= size; column++)
        {
            cout << "X";
        }

        cout << endl;
    }

    return 0;
}