My do while works the first time but the second time it breaks at the
len = Convert.ToDouble(Console.ReadLine());
It says that I have an unhandled System format exception. Help!
using System;
using System.Text;
namespace assignment1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Assignment1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
rectangle rect = new rectangle();
double len, wide;
int any;
bool option;
do
{
Console.Write("Enter length of rectangle: ");
len = Convert.ToDouble(Console.ReadLine());
Console.Write("\nEnter width of rectangle: ");
wide = Convert.ToDouble(Console.ReadLine());
rect.assign(len, wide);
Console.Write("Rectangle length = " +rect.getLength() + "\n");
Console.Write(" width =" + rect.getWidth() + "\n");
Console.Write(" area =" + rect.getArea() + "\n");
Console.Write("\n Do you want to continue? Type 1 to continue, 2 to
stop: ");
any = Console.Read();
if (any == '1')
option = true;
else
option = false;
}
while (option);
// for(int i = 0; i < 50; i++)
// {Console.Write("\n DSorry but you need to have a loop structure to
accomplish this");}
for(int i = 0; i < 50; i++)
{Console.Write("\n Oh well see you next time");}
}
}
}