/*Tokenizing Square*/
#include<iostream>
using namespace std;
#define n '\n';
void InputData (int &height, int &width)
{
//Stores data input by the user.
cout << "Enter in the height of your square: ";
cin >> height;
cout << n;
cout << "Enter in the width of your square: ";
cin >> width;
cout << n;
}
void Draw (int &height, int &width)
{
/*Draws the square. This function operates using the c variable to control wich
of the loops fires.*/
int a, b, c = 0;
a = height;
b = width;
c = 3;
/*The following two if statements check to make sure the dimensions aren't too
high.*/
if(height > 30)
{
cout << "Too large of a height, enter in something smaller!";
cout << n;
cout << n;
c = 0;
}
if(width > 30)
{
cout << "Too large of a width, enter in something smaller!";
cout << n;
cout << b;
c = 0;
}
while (b > 0, c == 3)
{
if (b == width)
{
cout << " ";
}
cout << "__";
b--;
if (b == 0)
{
cout << n;
c = 2;
b = width;
}
}
while (a > 0, c == 2)
{
cout << "|";
for (b = width; b > 0; b--)
{
cout << "__";
}
cout << "|";
cout << n;
a--;
b = width;
if (a == 0)
{
c = 1;
a = height;
}
}
while (b > 0, c == 1)
{
if (b == width)
{
cout << "|";
}
cout << "__";
b--;
if (b == 0)
{
c = 0;
b = width;
cout << "|";
cout << n;
cout << n;
}
}
}
int main()
{
//This is the main loop, which is a do while loop.
int height = 7;
int width = 10;
Draw(height, width);
return 0;
}