#!/usr/local/bin/gentee -r

func double rectangle( double x y )
{
   return 2.0 * ( x + y )
}

func double circle( double x )
{
   return 2.0 * 3.1415 * x
}

func main<main>
{
   str     input
   double  width height
   
   while 1
   {
   	print("Enter the number of the action:
1. Calculate the perimeter of a rectangle
2. Calculate the perimeter of a circle
3. Exit\n")
		switch getch()
      {
      	case '1' 
         {
		   	print("Specify the width of the rectangle: ")
				width = double( conread( input ))
		   	print("Specify the height of the rectangle: ")
				height = double( conread( input ))
		   	print("The perimeter of the rectangle: \( rectangle( width, height ))\n\n")
         }
         case '2' 
         {
		   	print("Specify the radius of the circle: ")
				width = double( conread( input ))
		   	print("The perimeter of the circle: \( circle( width ))\n\n")
         }
         case '3', 27 : break
         default : print("You have entered a wrong value!\n\n")
      }
   }
}
