// Calculate the area of a circle
// Uses prompt.
// the purpose of this tutorial is to discover how to turn strings into numbers.
// and prompt for information from the command line.

// Code is public domain.
// Written T. McKeaveney, April 2008.


import std.conv;
import std.stdio;
import std.string;
import std.math;

const real pi = std.math.PI;

void main()
{
   try
   {
      char [] chRadius;
      float r;
      writef("Enter the radius: ");
      chRadius = chomp(readln(stdin));
      r = toFloat(chRadius);
      writefln("Circle area = %f", pi*r*r);
   }
   catch (Exception e)
   {
      writefln("catch %s", e.toString());
   }
}


/* Common Errors:

1. tofloat instead of toFloat --> check capitilazation
2. std.math.pi / PI   --> check capitilazation
3. forgetting the import
4. (real x float x float=>? )  needs to be cast to a specific type for printf
5. Declaring the Exception in the catch block
6. Removing the trailing white space imported from the command line
*/