the output should be:
Triangle Drawer
Enter the size of the triangle: 0
The size is out of range.
Enter the size of the triangle: 11
The size is out of range.
Enter the size of the triangle: cats
An invalid value was entered.
Enter the size of the triangle: 10
TTTTTTTTTT
TTTTTTTTT
TTTTTTTT
TTTTTTT
TTTTTT
TTTTT
TTTT
TTT
TT
T
Press any key to exit:
Console.Title = "Triangle Drawer";
Console.Write("{0, 40}", "Triangle Drawer");
int iSize = 0;
bool bError;
do
{
try
{
bError = false;
Console.Write("\nEnter the size of the triangle: ");
iSize = int.Parse(Console.ReadLine());
if ((iSize <= 1) || (iSize >= 11))
{
Console.Write("\nThe size is out of range.");
bError = true;
}
}
catch (FormatException)
{
Console.Write("\nAn invalid value was entered.");
bError = true;
}
finally
{
Console.WriteLine("");
bError = true;
}
for (int iRow = 0; iRow < iSize; iRow++)
{
for (int iColumn = 0; iColumn < iSize; iColumn++)
Console.Write("T");
Console.WriteLine();
}
}
while (bError);
Console.WriteLine("Press any key to exit.");
Console.ReadLine();
mine is showing like this
TTTT
TTTT
TTTT
TTTT
TTTT